How does EK9 detect reference conflicts and unresolved references?
← Code Quality · Ref: Q741
EK9 validates all module references at compile time and detects two categories of problems.
REFERENCES CONFLICT (E03020)
The same symbol cannot be referenced twice in a references block. Each external symbol should appear exactly once. Duplicating a reference serves no purpose and may indicate a copy-paste error.
REFERENCE DOES NOT RESOLVE (E03030)
A reference must point to an existing module and symbol. If the module path or symbol name is misspelled, or the module does not exist, the compiler rejects the reference. This catches typos and stale references early.
CORRECT PATTERNS
Ensure each reference appears once and points to a valid module::Symbol. Use fully qualified inline access as an alternative to the references block.
See Q726 for module reference syntax. See Q142 for cross-module constants.
Example
defines module qa.codequality.referenceconflicts defines function formatItem() as pure -> text as String <- rtn as String: `[${text}]` defines program ReferenceConflictsDemo() stdout <- Stdout() //Direct function call within same module result <- formatItem("hello") stdout.println(result) stdout.println(formatItem("world"))
Common mistakes
E50060 — String has no getValue() method. formatItem() already returns a String. See ek9 -h E50060 for details.
Incorrect:
result <- formatItem("hello").getValue()
Correct:
result <- formatItem("hello")
E50060 — String has no toString() method in EK9. The function already returns a String. See ek9 -h E50060 for details.
Incorrect:
stdout.println(formatItem("world").toString())
Correct:
stdout.println(formatItem("world"))
Other ways to ask this
- What is E03020 references conflict in EK9?
- What is E03030 reference does not resolve in EK9?
- Why does my module reference fail to compile?
Coming from another language?
Java: duplicate imports produce warnings. Python: duplicate imports silently overwrite. Rust: duplicate use statements produce errors. Go: unused imports are errors. EK9: duplicate references and unresolved references are both compile-time errors.
Keywords: E03030, resolve, quality, conflict, import, module, duplicate, E03020, missing, reference