E06250: the order and naming of arguments must match parameters
What went wrong
When using named parameters, the names must EXACTLY match the parameter names in the method/function definition.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 1343 (Why does EK9 reject a named argument whose name does n...)
How to fix it
- Check function/method signature for correct parameter names
- Match parameter names exactly (case-sensitive)
- Keep named parameters in declaration order
Common causes
- Typo in parameter name
- Wrong parameter name from memory
- Parameters in wrong order with wrong names
- Refactoring changed parameter names
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E06250: the order and naming of arguments must match parameters
#!ek9 defines module error.e06250.bad defines class Ledger record() -> label as String amount as Float <- rtn as Boolean: label? and amount? defines function wrongNames() <- rtn as Boolean? ledger <- Ledger() rtn: ledger.record( name: "Steve", total: 1.0 ) wrongOrder() <- rtn as Boolean? ledger <- Ledger() rtn: ledger.record( amount: "Steve", label: 1.0 )
Fixed: Use the parameters' own names, in their own order
#!ek9 defines module error.e06250.good defines class Ledger record() -> label as String amount as Float <- rtn as Boolean: label? and amount? defines function rightNames() <- rtn as Boolean? ledger <- Ledger() rtn: ledger.record(label: "Steve", amount: 1.0)
Questions and answers
These Q&A entries show E06250 and its fix: