E06300: require one argument only

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

What went wrong

This operation requires EXACTLY one argument, but you provided a different number (zero or more than one).

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 124 (How do I group and aggregate collection data in EK9?)

How to fix it

  1. Provide exactly one argument for operations that require it
  2. For unary operators (++, --, !, ?) - they work on single operand
  3. Check constructor/method signature

Common causes

  • Unary operator with wrong argument count
  • Single-parameter constructor with multiple values
  • Forgot argument or added extra

See also

  • E06300: requires exactly ONE argument (this error)
  • E06280: too many arguments (general)
  • E06290: too few arguments (general)
  • E06310: takes NO arguments

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E06300: require one argument only

#!ek9
defines module error.e06300.bad

  defines function

    joined()
      ->
        first as Integer
        second as Integer
      <- rtn as String: `${first}${second}`

    mapTwoAtATime()
      stdout <- Stdout()
      //'map' passes ONE item at a time
      cat [1, 2, 3] | map with joined > stdout

Fixed: Give 'map' a function of one parameter

#!ek9
defines module error.e06300.good

  defines function

    asText()
      -> number as Integer
      <- rtn as String: `#${number}`

    mapOneAtATime()
      stdout <- Stdout()
      cat [1, 2, 3] | map with asText > stdout

Questions and answers

These Q&A entries show E06300 and its fix: