Why does my references statement fail with E03030 reference does not resolve?

← Syntax and Structure Rules · Ref: Q1308

E03030 means a 'references' entry uses a fully-qualified name (module.path::SymbolName) whose module path or symbol name the compiler cannot find. The format is valid (it has the '::' separator, so it is not E01010), but nothing in the compile path actually resolves to it.

COMMON CAUSES

1. Typo in the symbol name: org.ek9.lang::Lst instead of ::List.
2. Typo in the module path: org.ek9.lng::List (missing 'a').
3. The defining module is not in the compile path (companion file missing, dependency not added).
4. The type lives in a different module than the one you named.

HOW TO FIX

Verify the exact module path and symbol name against the defining module's 'defines' sections, and make sure that module compiles and is part of the same workspace/compile path. Once the name matches a real exported symbol, the reference resolves and the short name becomes usable.

DISTINCTION FROM RELATED ERRORS

E01010 is a FORMAT error (the '::' qualifier is missing entirely). E03030 is a RESOLUTION error (the format is fine but the target does not exist at import time). E50001 is the same idea at USE time for a bare identifier rather than a references entry.

See Q726 for references syntax. See Q851 for the module qualifier rule.

Example

defines module qa.ref.consumer.resolve

  //THE FIX: the references entry names a real, exported symbol on a real
  //module path, so it resolves at REFERENCE_CHECKS time and the short
  //name 'List' becomes usable. A typo such as 'Lst' or a wrong module
  //path (org.ek9.lng) would fail to resolve and raise E03030.
  references
    org.ek9.lang::List

  defines program

    ReferenceResolveDemo()
      stdout <- Stdout()

      names <- List() of String
      names += "World"
      stdout.println(`Greeting list size: ${length names}`)

Common mistakes

E03030 — The reference 'org.ek9.lang::Lst' is well-formed (it has the '::' qualifier) but no symbol named 'Lst' exists in module 'org.ek9.lang' - the real exported symbol is 'List'. Because the name does not resolve at import time, REFERENCE_CHECKS raises E03030. Fix the typo so the symbol name matches a real exported symbol, and ensure the defining module is in the compile path. See ek9 -h E03030 for details.

Incorrect:

references
  org.ek9.lang::Lst

Correct:

references
    org.ek9.lang::List
Other ways to ask this
  • What triggers E03030 in EK9?
  • Why can't the compiler find the type named in my references block?
  • How do I fix a references entry that points at a module or type that does not exist?

Coming from another language?

Java: a wrong import (import com.example.Lst) is a compile error 'cannot find symbol' / 'package does not exist'. Python: a bad 'from module import Name' raises ImportError at runtime, not compile time. Go: an unresolved import path fails the build. Rust: 'use std::collections::Vc' for a missing item is a compile error E0432. EK9: a references entry that does not resolve is caught at compile time in REFERENCE_CHECKS as E03030.

Keywords: resolve, module, syntax, REFERENCE_CHECKS, reference, qualifier, E03030, typo, import