Diagnostics
Every diagnostic the E# compiler emits — 34 codes, grounded in the
binder/emitter source. 22 carry negative-test coverage in the
corpus; each links to the verified .es programs that provoke it,
so the test suite is browsable by diagnostic. The IL compiler is the source of truth — unverifiable
IL surfaces as ES0900 at build time rather than a run-time
InvalidProgramException.
Numbering is grouped by phase: ES0xxx resolution / verification ·
ES1xxx declarations & const · ES2xxx types, pointers,
inheritance, events, names · ES3xxx async-let & data construction ·
ES9xxx workspace / fusion crashes. Gaps in the sequence (e.g. ES2127, ES2129) are unused.
| Code | Severity | Trigger | Examples |
|---|---|---|---|
| ES0001 | Error | Fallback diagnostic — an unresolved type, method, or variable, or a backend resolution failure (e.g. IL: unresolved indexer). | 0 |
| ES0900 | Error | Emitted IL failed ILVerify — surfaced at build time (project / Workspace path) instead of as a run-time InvalidProgramException, naming the offending Type::Method. | 0 |
| ES1010 | Error | A top-level statement appears in a static func body, which may hold only fields, const, and func declarations. | 2 |
| ES1011 | Error | A const initializer does not fold to a compile-time literal. | 0 |
| ES2002 | Error | A value data field references the type directly (or via a generic container) — the struct would be infinitely large. | 5 |
| ES2003 | Error | *RefData or new RefData — illegal, a ref data is already a reference. | 3 |
| ES2120 | Error | A plain func has the same name as a virtual/abstract member on the base type. | 1 |
| ES2121 | Error | A : func marker has no body in a concrete (non-abstract) subclass. | 1 |
| ES2122 | Error | A : func marker matches no virtual/abstract member on the inheritance chain. | 1 |
| ES2123 | Error | A : func marker targets a parent member that is neither virtual nor abstract. | 0 |
| ES2124 | Error | A : prefix is used in a class that declares no base type or interface. | 1 |
| ES2125 | Error | An abstract func is declared outside an abstract ref data. | 1 |
| ES2126 | Error | A virtual func is declared on a sealed class (sealed is the default). | 1 |
| ES2128 | Error | A : base(...) call’s argument count does not match the base init signature. | 1 |
| ES2130 | Error | A var is captured by a function literal across a task func boundary. | 3 |
| ES2131 | Error | yield appears outside a function whose return type is IAsyncEnumerable<T>. | 0 |
| ES2140 | Error | Two triggers: (a) an event is declared on a non-ref data (events imply identity); (b) a non-void function does not return on every path. | 1 |
| ES2141 | Error | An event is typed by something that is not a delegate. | 0 |
| ES2142 | Error | Two triggers: (a) a value-receiver method is called as a free function (bump(v) instead of v.bump()); (b) raise names an event not declared on the enclosing ref data. | 1 |
| ES2143 | Warning | The deprecated &T { ... } heap-allocation spelling. | 1 |
| ES2144 | Error | new is applied to a non-data type; it heap-allocates a value data into a *T. | 3 |
| ES2145 | Error | Indexing ([...]) a non-indexable type (a data, choice, or enum). | 5 |
| ES2150 | Error | A bare type name lives in another namespace. | 1 |
| ES2151 | Error | A bare type name is ambiguous — visible from two in-scope/imported namespaces at once. | 2 |
| ES2152 | Error | A bare free-function name lives in another namespace. | 0 |
| ES2153 | Warning | A type structurally matches an interface it does not declare — conformance is nominal. | 2 |
| ES2160 | Error | A type name is not PascalCase. | 2 |
| ES2161 | Error | A free-function name is not camelCase. | 0 |
| ES3004 | Warning | An async let initializer is a user function with no await; it is auto-wrapped in Task.Run for fan-out. | 1 |
| ES3005 | Error | An async let initializer is not a function call or awaitable expression. | 0 |
| ES3012 | Error | An init block is declared on a value-semantic data, which has no constructors. | 3 |
| ES9001 | Error | Assembly fusion (ILRepack) of the E# and C# halves failed. | 0 |
| ES9002 | Error | The E# IL emission phase threw an unhandled exception. | 0 |
| ES9003 | Error | The C# half (Roslyn) emission threw an unhandled exception. | 0 |
ES0001 error
Fallback diagnostic — an unresolved type, method, or variable, or a backend resolution failure (e.g. IL: unresolved indexer).
Fix. Most specific errors carry a higher code; ES0001 is the default sink. Usually a missing using, a typo, or an unresolvable member.
No corpus negative example yet.
ES0900 error
Emitted IL failed ILVerify — surfaced at build time (project / Workspace path) instead of as a run-time InvalidProgramException, naming the offending Type::Method.
Fix. Indicates a compiler bug or an unsupported construct producing malformed IL — report it with the named method.
No corpus negative example yet.
ES1010 error
A top-level statement appears in a static func body, which may hold only fields, const, and func declarations.
Fix. Move the statement into a func.
Corpus (2): ILEmitterTests_StaticFunc__StaticFunc_RejectsTopLevelStatements · ILEmitterTests_StaticFunc__StaticFunc_RejectsBareReturn
ES1011 error
A const initializer does not fold to a compile-time literal.
Fix. Use let for a runtime value; const is for literals only.
No corpus negative example yet.
ES2002 error
A value data field references the type directly (or via a generic container) — the struct would be infinitely large.
Fix. Break the cycle with a pointer: next: *Node (or List<*Tree>).
Corpus (5): DataContractTests__RecursiveField_DirectSelfReference_Errors · DataContractTests__RecursiveField_PointerForm_Ok · DataContractTests__RecursiveField_InGenericContainer_Errors · DataContractTests__RecursiveField_ListOfPointer_Ok · DataContractTests__RecursiveField_RefDataAllowsSelfReference
ES2003 error
*RefData or new RefData — illegal, a ref data is already a reference.
Fix. Drop the *; construct it bare (Conn { ... }, no new).
Corpus (3): ILEmitterTests_HeapPointer__HeapPointer_StarRefData_Error · ILEmitterTests_New__Neg_NewRefData_IsES2003 · ILEmitterTests_PointerModel__StarRefData_IsError
ES2120 error
A plain func has the same name as a virtual/abstract member on the base type.
Fix. Prefix with : to override, or rename.
Corpus (1): ILEmitterTests_Inheritance__Plain_Func_Shadowing_Virtual_Parent_Is_ES2120
ES2121 error
A : func marker has no body in a concrete (non-abstract) subclass.
Fix. Supply a body, mark the class abstract, or remove the :.
Corpus (1): ILEmitterTests_Inheritance__Colon_Func_Without_Body_In_Concrete_Subclass_Is_ES2121
ES2122 error
A : func marker matches no virtual/abstract member on the inheritance chain.
Fix. Check the name against the base, or remove the :.
Corpus (1): ILEmitterTests_Inheritance__Colon_Func_With_No_Matching_Parent_Is_ES2122
ES2123 error
A : func marker targets a parent member that is neither virtual nor abstract.
Fix. Make the parent member virtual, or rename.
No corpus negative example yet.
ES2124 error
A : prefix is used in a class that declares no base type or interface.
Fix. Add a base/interface to the header, or remove the :.
Corpus (1): ILEmitterTests_Inheritance__Colon_Marker_Without_Inheritance_Header_Is_ES2124
ES2125 error
An abstract func is declared outside an abstract ref data.
Fix. Mark the class abstract, or give the method a body.
Corpus (1): ILEmitterTests_Inheritance__Abstract_Func_Outside_Abstract_Class_Reports_ES2125
ES2126 error
A virtual func is declared on a sealed class (sealed is the default).
Fix. Declare the class open or abstract.
Corpus (1): ILEmitterTests_Inheritance__Virtual_Func_On_Sealed_Class_Reports_ES2126
ES2128 error
A : base(...) call’s argument count does not match the base init signature.
Fix. Match the base init parameter count.
Corpus (1): ILEmitterTests_Inheritance__Init_Mismatched_BaseArgs_Is_ES2128
ES2130 error
A var is captured by a function literal across a task func boundary.
Fix. Move shared state into a chan<T> parameter, or capture a let.
Corpus (3): ILEmitterTests_TaskFunc__TaskFunc_Var_Capture_In_Function_Literal_Reports_ES2130 · ILEmitterTests_TaskFunc__TaskFunc_Let_Capture_In_Function_Literal_Is_OK · ILEmitterTests_TaskFunc__RegularFunc_Var_Capture_Is_Not_ES2130
ES2131 error
yield appears outside a function whose return type is IAsyncEnumerable<T>.
Fix. Change the return type to an async stream, or remove the yield.
No corpus negative example yet.
ES2140 error
Two triggers: (a) an event is declared on a non-ref data (events imply identity); (b) a non-void function does not return on every path.
Fix. (a) Declare the type as ref data. (b) Return on every path — the check is exhaustive-match-aware.
Corpus (1): ILEmitterTests_Coverage_Adversarial__DefiniteReturn_FallThrough_IsError
ES2141 error
An event is typed by something that is not a delegate.
Fix. Type it with a delegate — Action, EventHandler<T>, or a delegate func.
No corpus negative example yet.
ES2142 error
Two triggers: (a) a value-receiver method is called as a free function (bump(v) instead of v.bump()); (b) raise names an event not declared on the enclosing ref data.
Fix. (a) Call it as a method. (b) Declare the event on the enclosing ref data.
Corpus (1): ILEmitterTests_Coverage_Adversarial__Ns_ValueReceiverFreeCall_IsError
ES2143 warning
The deprecated &T { ... } heap-allocation spelling.
Fix. Use new T { ... } — it lowers identically.
Corpus (1): ILEmitterTests_New__New_EmitsNoDeprecationWarning
ES2144 error
new is applied to a non-data type; it heap-allocates a value data into a *T.
Fix. Only new a value data.
Corpus (3): ILEmitterTests_New__Neg_NewExternalGeneric_IsES2144 · ILEmitterTests_New__Neg_NewExternalType_IsES2144 · ILEmitterTests_New__New_PositionalGenericExternal_IsError_List
ES2145 error
Indexing ([...]) a non-indexable type (a data, choice, or enum).
Fix. Index a List, array, string, or other indexable type.
Corpus (5): IndexDiagnosticTests__IndexingData_Errors · IndexDiagnosticTests__IndexingChoice_Errors · IndexDiagnosticTests__IndexingEnum_Errors · IndexDiagnosticTests__IndexingList_DoesNotError · IndexDiagnosticTests__IndexingString_DoesNotError
ES2150 error
A bare type name lives in another namespace.
Fix. Add using "NS" or qualify as NS.Type.
Corpus (1): ILEmitterTests_Coverage_Adversarial__Ns_BareCrossNamespace_WithoutUsing_IsError
ES2151 error
A bare type name is ambiguous — visible from two in-scope/imported namespaces at once.
Fix. Qualify (A.Widget) or alias one (using W = "A.Widget").
Corpus (2): ILEmitterTests_ExternalReflection__AmbiguousExternalType_AcrossImports_ReportsES2151 · ILEmitterTests_ExternalReflection__QualifiedExternalType_SilencesAmbiguity
ES2152 error
A bare free-function name lives in another namespace.
Fix. Add using "NS" or qualify as NS.fn.
No corpus negative example yet.
ES2153 warning
A type structurally matches an interface it does not declare — conformance is nominal.
Fix. Add : IFoo to declare the conformance explicitly.
Corpus (2): ILEmitterTests_Nominal__Undeclared_StructuralMatch_RejectedAndSuggested · ILEmitterTests_Nominal__Added_UndeclaredStructuralMatch_WarnsES2153
ES2160 error
A type name is not PascalCase.
Fix. Start the type name with an uppercase letter.
Corpus (2): ILEmitterTests_Coverage_Adversarial__Ns_LowerCaseTypeName_IsError · ILEmitterTests_Coverage_Adversarial__Ns_SnakeCaseTypeName_IsError
ES2161 error
A free-function name is not camelCase.
Fix. Start the free-function name with a lower-case letter (methods and static func members may be PascalCase).
No corpus negative example yet.
ES3004 warning
An async let initializer is a user function with no await; it is auto-wrapped in Task.Run for fan-out.
Fix. Add await inside the callee to make it naturally async, or accept the thread-pool hop.
Corpus (1): AsyncIntegrationTests__AsyncLet_SyncUserFunc_IL_WrapsInTaskRun
ES3005 error
An async let initializer is not a function call or awaitable expression.
Fix. Wrap a non-call expression in Task.Run(() => ...).
No corpus negative example yet.
ES3012 error
An init block is declared on a value-semantic data, which has no constructors.
Fix. Construct with a composite literal T { ... } or a factory func; or declare the type as ref data.
Corpus (3): DataContractTests__InitBlock_OnData_Errors · DataContractTests__InitBlock_OnRefData_Ok · DataContractTests__PositionalForm_OnData_StillWorks
ES9001 error
Assembly fusion (ILRepack) of the E# and C# halves failed.
Fix. Internal — report with the message.
No corpus negative example yet.
ES9002 error
The E# IL emission phase threw an unhandled exception.
Fix. Internal — report with the message.
No corpus negative example yet.
ES9003 error
The C# half (Roslyn) emission threw an unhandled exception.
Fix. Internal — report with the message.
No corpus negative example yet.