E03030: reference does not resolve

Category: E03xxx Duplication checks · Reported in phase: REFERENCE_CHECKS · Classification: REFERENCE_DOES_NOT_RESOLVED · All error codes

What went wrong

A 'references' statement points to a module or type that doesn't exist. The compiler cannot find what you're trying to import.

Worked examples

Compilable examples demonstrating this error and the correct fix:

Common causes

  1. Typo in module path: typo.in.module::MyClass vs actual.module::MyClass
  2. Typo in type name: module::MyClss vs module::MyClass
  3. Module not compiled/available:
  • Dependency not in compile path
  • Module file not in expected location
  1. Wrong module for the type:
  • Type exists but in different module than specified
  1. The module named only IMPORTS it:
  • 'references beta::Widget' where beta itself only has 'references delta::Widget'. A reference is shorthand inside the importing module; it is never re-exported. Reference the module that DEFINES it - the error message names it: delta::Widget

How to fix it

  • Verify the exact module path and type name
  • Check that the source module compiles successfully
  • Ensure dependency is in your compile path
  • Use IDE autocomplete to find correct path

Verification

  • Compile the dependency module first
  • Check the module's 'defines' sections for exported types
  • Ensure types are not marked private

See also

  • E03030: Reference doesn't RESOLVE (import time)
  • E50001: Identifier doesn't resolve (use time)
  • E01010: Invalid reference FORMAT (missing ::)

Examples

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

Fails with E03030: reference does not resolve

#!ek9
defines module error.e03030.bad

  references
    //No module of that name is in the compile
    com.nonexistent.module::Helper
    //The module exists, but holds no construct of that name
    org.ek9.lang::Helper

  defines function

    describe()
      <- rtn as String: "nothing to help with"

Fixed: Reference a construct a module in the compile really defines, spelled exactly

#!ek9
defines module error.e03030.good

  references
    error.e03030.good.utilities::Helper

  defines function

    describe()
      <- rtn as String: Helper().describe()

Fixed: The module it comes from must be part of the compile

#!ek9
defines module error.e03030.good.utilities

  defines class

    Helper
      describe()
        <- rtn as String: "a helper"

Questions and answers

These Q&A entries show E03030 and its fix: