E06250: the order and naming of arguments must match parameters

Category: E06xxx Type hierarchy checks · Reported in phase: FULL_RESOLUTION · Classification: NAMED_PARAMETERS_MUST_MATCH_ARGUMENTS · All error codes

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

  1. Check function/method signature for correct parameter names
  2. Match parameter names exactly (case-sensitive)
  3. 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

  • E06250: wrong parameter name (this error)
  • E06240: mixed named/positional parameters
  • E06270: wrong parameter type

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:

Found a problem?

If EK9 reported E06250 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.