E06310: function must have no arguments
What went wrong
This function/operation takes NO arguments, but you provided some.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 867 (Why must functions used with stream call take zero argume...)
How to fix it
- Remove arguments from call
- If you need parameterized version, check for overloads
- Maybe you intended to call a different method
Common causes
- Calling parameterless method with arguments
- Default constructor doesn't accept values
- Wrong overload selected
- Method was refactored to be parameterless
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E06310: function must have no arguments
#!ek9 defines module error.e06310.bad defines function doubled() -> number as Integer <- rtn as Integer: number * 2 callNeedsArguments() <- rtn as List of Integer? //'call' calls each function with NO arguments rtn: cat [doubled] | call | collect as List of Integer
Fixed: Give 'call' functions that take no arguments - or 'map with' a function of one
#!ek9 defines module error.e06310.good defines function answer() <- rtn as Integer: 42 doubled() -> number as Integer <- rtn as Integer: number * 2 callAndMap() <- rtn as List of Integer: cat [answer] | call | map with doubled | collect as List of Integer
Questions and answers
These Q&A entries show E06310 and its fix: