E07160: implementation must be provided

Category: E07xxx Full resolution · Reported in phase: SYMBOL_DEFINITION · Classification: IMPLEMENTATION_MUST_BE_PROVIDED · All error codes

What went wrong

A non-abstract method is missing its implementation body. If a method isn't abstract, it must have a body.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 1313 (Why does EK9 reject an application that has no registe...)

How to fix it

  1. Provide implementation body
  2. Or mark as abstract if no implementation intended
  3. Every non-abstract method needs a body

Common causes

  • Incomplete method definition
  • Accidentally deleted implementation
  • Forgot to add body after signature

See also

  • E07160: non-abstract method missing body (this error)
  • E07110: method without body and not abstract
  • E07100: abstract with body

Examples

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

Fails with E07160: implementation must be provided

#!ek9
defines module error.e07160.bad

  defines program

    //Valid Program
    NoArgument()
      //Just some body to stop any other compiler errors
      v <- "Steve"
      require v?

    //Failure1 - a program must have a body. (Its argument TYPES are checked in EXPLICIT_TYPE_SYMBOL_DEFINITION -
    //see phase2/badPrograms/ArgumentTypeChecks.ek9 - front-end audit FE36.)
    BadArgumentCombination()
      ->
        count as Integer
        arguments as List of String

Fixed: Give the program a body

#!ek9
defines module error.e07160.good

  defines program

    //A program always has a body, even when it takes arguments
    CountItems()
      ->
        name as String
        count as Integer

      stdout <- Stdout()
      stdout.println(`${name} has ${count} items`)

Questions and answers

These Q&A entries show E07160 and its fix: