E07820: only one method can be marked as a dispatcher entry point

Category: E07xxx Full resolution · Reported in phase: FULL_RESOLUTION · Classification: DISPATCHERS_ONLY_HAVE_ONE_METHOD_ENTRY_POINT_MARKED · All error codes

What went wrong

You have multiple methods marked as dispatcher entry points, but only one method can be the dispatcher entry.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 613 (Can a derived class dispatcher target a private handler i...)

How to fix it

  1. Mark only one method as dispatcher
  2. Other methods can be dispatch targets

Common causes

  • Multiple dispatcher methods
  • Copy/paste error

See also

  • E07820: multiple dispatchers in class (this error)
  • E07810: dispatcher outside class

Examples

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

Fails with E07820: only one method can be marked as a dispatcher entry point

#!ek9
defines module error.e07820.bad

  defines class

    Shape as open
      kind()
        <- rtn as String: "shape"

    Circle extends Shape
      override kind()
        <- rtn as String: "circle"

    Describer
      describe() as dispatcher
        -> circle as Circle
        <- rtn as String: "a round " + circle.kind()

      describe() as dispatcher
        -> shape as Shape
        <- rtn as String: "some " + shape.kind()

      //Only the entry point is marked

Fixed: Mark only the entry point

#!ek9
defines module error.e07820.good

  defines class

    Shape as open
      kind()
        <- rtn as String: "shape"

    Circle extends Shape
      override kind()
        <- rtn as String: "circle"

    Describer
      //The one entry point
      describe()
        -> circle as Circle
        <- rtn as String: "a round " + circle.kind()

      describe() as dispatcher
        -> shape as Shape
        <- rtn as String: "some " + shape.kind()

      //A handler: not marked

Questions and answers

These Q&A entries show E07820 and its fix: