E03010: conflicts with a reference
What went wrong
You've defined a local type (class, record, trait, function or text) with the same name as a type you've imported via 'references'. This creates ambiguity. A local construct named like a BUILT-IN type (a local class 'List', even beside 'references org.ek9.lang::List') is reported as E01090 instead - E03010 is the clash with a type referenced from another module.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 832 (Why can't I have a local class with the same name as an ...)
- ek9 -q 1392 (Why can't a variable, parameter or named capture have th...)
How to fix it
- Rename your local type to be distinct
- Or remove the reference and use fully qualified names when needed
Common causes
- Importing a type then forgetting it's imported
- Using generic names like 'Utils', 'Helper' that may conflict
- A variable, parameter, loop variable or NAMED capture '(remote: 7)' named like something imported with 'references' - rename it
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E03010: conflicts with a reference
#!ek9 defines module error.e03010.bad //A reference says "use the one from that module" - even when that module is this one references error.e03010.bad::SharedClass error.e03010.bad::sharedFunction defines class SharedClass label as String: "local" default operator ? defines function sharedFunction() <- rtn as String: "local"
Fixed: Reference the other module's constructs and use them; do not define them again
#!ek9 defines module error.e03010.good references error.e03010.good.shared::SharedClass error.e03010.good.shared::sharedFunction defines function describe() <- rtn as String: `${sharedFunction()} ${SharedClass().label()}`
Fixed: Or keep your own definitions and drop the references
#!ek9 defines module error.e03010.good.local defines class SharedClass label as String: "local" default operator ? defines function sharedFunction() <- rtn as String: "local"
Fixed: The module that defines them, once
#!ek9 defines module error.e03010.good.shared defines class SharedClass text as String: "shared" label() <- rtn as String: text default operator ? defines function sharedFunction() <- rtn as String: "shared function"
Questions and answers
These Q&A entries show E03010 and its fix:
Found a problem?
If EK9 reported E03010 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.