E03020: conflicting references

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

What went wrong

Two or more 'references' statements import types with the same name. When you use that name, EK9 can't tell which import you mean.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 1307 (Why does EK9 reject the same symbol listed twice in a...)

How to fix it

  • Keep the more frequently used reference
  • Use fully qualified names for the less common one
  • Or remove both and always use fully qualified names

Common causes

  • Multiple libraries with similar type names
  • Refactoring that added conflicting imports

See also

  • E03020: Two REFERENCES conflicting
  • E03010: LOCAL type vs REFERENCE conflict
  • E03030: Reference path doesn't RESOLVE at all

Examples

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

Fails with E03020: conflicting references

#!ek9
defines module error.e03020.bad

  references
    org.ek9.lang::Optional
    org.ek9.lang::Optional

  defines function

    nothingYet()
      <- rtn as Optional of String: Optional()

Fixed: Reference each construct once

#!ek9
defines module error.e03020.good

  references
    org.ek9.lang::Optional

  defines function

    nothingYet()
      <- rtn as Optional of String: Optional()

Questions and answers

These Q&A entries show E03020 and its fix: