E50001: not resolved

Category: E50xxx Common errors · Reported in phase: FULL_RESOLUTION · Classification: NOT_RESOLVED · All error codes

What went wrong

The compiler cannot find a variable or identifier with this name in the current scope. The name is not recognized as any declared symbol.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 22 (How do I declare a variable in EK9?)
  • ek9 -q 17 (Where is the main function in EK9?)
  • ek9 -q 3 (How do I print output to the console?)
  • ek9 -q 46 (How does the Dict type work in EK9?)
  • ek9 -q 33 (How do I work with regular expressions?)
  • ek9 -q 1380 (How do I split my code across multiple .ek9 files in one ...)

How to fix it

  1. Check spelling - EK9 is case-sensitive
  2. Ensure variable is declared before use
  3. Add reference statement if the name is in another MODULE
  4. If the name is in another FILE of the same module, that file is not in the build - add a package.ek9 with applyStandardIncludes (see ek9 -q 1380)
  5. Check variable scope (may be out of scope)

Common causes

  • Typo in variable/identifier name
  • Variable not declared in this scope
  • Missing import/reference statement
  • Declared in a sibling .ek9 file that the build does not include (same module is NOT enough - the package block decides which files are compiled)
  • Using variable before declaration
  • Variable declared in different scope (e.g., inner block)
  • A fully qualified name 'M::X' where module M only IMPORTS X with 'references'. A qualified name reaches only what its module DEFINES; the message names where X is defined - qualify it with that module

See also

  • E50001: identifier/variable not found (this error)
  • E50010: TYPE not found (class/record/trait names)
  • E50060: METHOD not found (method/function calls)

Examples

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

Fails with E50001: not resolved

#!ek9
defines module error.e50001.bad

  defines function

    greeting()
      -> customerName as String
      <- message as String?
      message: salutation + customerName

Fixed: Declare the name before you use it

#!ek9
defines module error.e50001.good

  defines function

    greeting()
      -> customerName as String
      <- message as String?
      salutation <- "Hello, "
      message: salutation + customerName

Questions and answers

These Q&A entries show E50001 and its fix: