E50010: type not resolved
What went wrong
The compiler cannot find a TYPE with this name in the current scope. This applies to classes, records, traits, functions, and other type names.
Worked examples
Compilable examples demonstrating this error and the correct fix:
Cascading error note
If you see MULTIPLE E50010 errors, fix the EARLIEST one first. Later errors often cascade from an unresolved type earlier in the file: a variable initialised from 'NonExistent()' on line 10 has no type, so a call on it on line 20 fails too - fix line 10 and line 20 resolves by itself.
How to fix it
- Check spelling - EK9 is case-sensitive for types
- Add reference statement for types from other modules
- For generics: ensure 'of T' parameter is provided
- Fix earliest error first if multiple appear
Common causes
- Type name misspelled
- Missing 'of T' generic parameter
- Type in different module without reference statement
- A fully qualified type 'M::X' where module M only IMPORTS X with 'references' - qualify it with the module that DEFINES it (the message names it)
- Using type name instead of instance (use `obj <- Type()` not `Type.method()`)
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E50010: type not resolved
#!ek9 defines module error.e50010.bad defines record Widget label as String: "widget" default operator ? defines function describe() -> item as Widgit <- rtn as String: "unknown" if item? rtn: item.label
Fixed: Spell the type as it is declared - or declare it
#!ek9 defines module error.e50010.good defines record Widget label as String: "widget" default operator ? defines function describe() -> item as Widget <- rtn as String: "unknown" if item? rtn: item.label
Questions and answers
These Q&A entries show E50010 and its fix:
- Q23: What basic types does EK9 have?
- Q26: Why does EK9 not have primitives?
- Q46: How does the Dict type work in EK9?
- Q204: How do I write black-box tests with expected output files in EK9?
- Q205: How do I write parameterized tests in EK9?
- Q207: What test output formats does EK9 support for CI/CD?
- Q208: How do I test output containing dynamic values like dates, GUIDs, or timestamps?
- Q269: How does EK9 handle input validation?
- Q647: Why cannot I use a function type as a generic constraint?
- Q680: How does EK9 resolve the diamond problem with trait method conflicts?
- Q744: How does EK9 reject constructing a program or application, and abstract types in sealed allow only lists?
- Q805: How do I organise tests relative to production code in EK9?
- Q1241: Create me a constrained EmailAddress type as String validated by a regex, then write a registerUser function that uses a guard to accept only valid emails.
- Q1297: Can records extend other records in EK9?