E07360: application selection not allowed in this context

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

What went wrong

You're using application selection syntax in a context where it's not supported.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 838 (Why can't I use 'with application of' on a regular class ...)

How to fix it

  1. Use application selection only in supported contexts
  2. Check EK9 documentation for correct syntax

Common causes

  • Wrong context for application selection
  • Syntax error

See also

  • E07360: application selection in wrong context (this error)

Examples

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

Fails with E07360: application selection not allowed in this context

#!ek9
defines module error.e07360.bad

  defines class

    Greeter

      //Only a program selects an application
      greet() with application of GreeterApp
        <- rtn as String: "hello"

  defines component

    Greeting as abstract
      message() as abstract
        <- rtn as String?

    EnglishGreeting extends Greeting
      override message()
        <- rtn as String: "hello"

  defines application

    GreeterApp
      register EnglishGreeting() as Greeting

Fixed: Select the application on a program

#!ek9
defines module error.e07360.good

  defines component

    Greeting as abstract
      message() as abstract
        <- rtn as String?

    EnglishGreeting extends Greeting
      override message()
        <- rtn as String: "hello"

  defines application

    GreeterApp
      register EnglishGreeting() as Greeting

  defines program

    //A program selects the application, and is given what it registers
    Greet() with application of GreeterApp
      greeting as Greeting!
      stdout <- Stdout()
      stdout.println(greeting.message())

Questions and answers

These Q&A entries show E07360 and its fix: