E03030: reference does not resolve
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:
- ek9 -q 1308 (Why does my references statement fail with E03030 refe...)
Common causes
- Typo in module path: typo.in.module::MyClass vs actual.module::MyClass
- Typo in type name: module::MyClss vs module::MyClass
- Module not compiled/available:
- Dependency not in compile path
- Module file not in expected location
- Wrong module for the type:
- Type exists but in different module than specified
- 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
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: