List of diagnostics that the compiler can produce.
In the future, we will add a description of each diagnosis with examples here.
This description will be used to generate documentation and the --explain
flag.
-
E0001: Unexpected input character -
E0002: Not closed string literal -
E0003: Not closed block comment -
E0004: Not closed rune literal -
E0005: Usage of a reserved identifier -
E0006: Invalid digit in literal -
E0007: Literal has no digits -
E0008: Invalid digit separator -
E0009: Invalid radix point -
E0010: Wrong mantissa for exponent -
E0011: Illegal character NUL -
E0012: Illegal byte order mark -
E0013: Unknown string prefix -
E0014: Rune literal cannot be empty -
E0015: Rune literal cannot contain new line in source code -
E0016: Rune literal cannot contain more than one character -
E0017: Unknown escape sequence -
E0018: Escape sequence is not terminated -
E0019: Illegal character in escape sequence TODO: Check IDs must then be re-numbered -
E0019.1: Escape sequence is invalid Unicode code point -
E0019.2: Escape sequence is invalid octal number -
E0019.3: Unknown rune literal prefix -
E0019.4: Byte literal cannot contains non-ASCII character -
E0019.5: Escape sequence is invalid byte value -
E0019.6: Byte literal cannot contain escape sequence with Unicode code point -
E0019.7: String literal cannot contain\0character -
E0019.9: Not terminated string interpolation -
E0019.10: No need to escape$in C string literal
E0020: Not expected tokenE0021: Missing condition inifexpressionE0022: Method receiver must have a nameE0023: Method receiver must have a typeE0024: Multiline comments cannot be used in array literalE0025: Result type should have one or two types in![]E0026: Prefix++/--is not supportedE0027: No need to specify:in type declarationE0028: Parameter should have a nameE0029: Invalid comparison operator (=== and !== are not supported)E0030: Too many expressions for fixed array sizeE0031: Import alias cannot be qualifiedE0032: To declare multiple constants useconst ( ... )syntaxE0033: Constant definition cannot have a type annotationE0034: Return types are denoted using->E0035:...fooupdate syntax is allowed only as first expressionE0036: Use$if/$elseinstead ofif/elsein compile timeifE0037: Cannot usea := foo()in comptimeifconditionE0038: To declare multiple vars usevar ( ... )syntaxE0039: Missed[after#in attributeE0040: Match expression can have only oneelsebranchE0041: Multiply return types must be wrapped in parenthesesE0042: Function literals cannot have a nameE0043: Module var definition cannot have a type annotation
E0050: Type mismatchE0051: Cannot dereference a non-pointer typeE0052: Type incorrectly implements interfaceE0053: Cannot index a non-array typeE0054:nilcan be cast only to a pointer typeE0055: Generic type parameters count mismatchE0056: Cannot pass a type as generic argument due constraintE0057: Missed constraint for generic type parameterE0058: Cannot instantiate a non-generic typeE0059: Generic argument in the method receiver must have the same name as the generic parameter in the declarationE0060: Cannot use an Option type without unwrappingE0061: No need to check a pointer type fornilbecause it cannot benilby design (warning)E0062:iscondition is always true at this point (warning)E0063:iscondition is always false at this point (warning)E0064: Pointer dereference requires unsafe blockE0065: Pointer arithmetic requires unsafe blockE0066: Pointer indexing requires unsafe blockE0067:orcan only be used with Option or Result typesE0068: Cannot unwrap a non-Option and non-Result typeE0069: Cannot call expression of typename
E0070: Redeclaration ofnameE0071: Shadowing ofnameE0072: Variadic parameter must be the last parameter in the signatureE0073: Duplicate parameter namenameE0074: Wrong number of argumentsE0075: Return statement with expression in function with no return typeE0076: Return statement missing expressionE0077: Unknown fieldE0078: Unknown methodE0079: Unresolved identifierE0080: Cannot match on barenone, cast it to a concrete Option type firstE0081: Receiver type cannot be variadicE0082: Literal cast overflowE0083: C bindings should always use pointers instead referencesE0084: Unknown interface methodE0085: Overflow while execute compile-time expressionE0086: Unreachable code (warning)E0087: Not all code paths return a valueE0088: Assigned value is not used (warning)E0089: Previous assigned value is not used (warning)E0090: Unused variable (warning)E0091: Break statements must be inside a loopE0092: Continue statements must be inside a loopE0093: Nested Option types are not allowedE0094: Function result type cannot bevoidE0095: Function without result cannot be used as a valueE0096: Function that never returns cannot be used as a valueE0097: Cannot usereturnin function that never returnsE0098: Unknown enum variantE0099: Enum with no variantsE0100: Cannot check if a non-pointer type is nil/not-nilE0101: Nested unsafe block is not allowedE0102: Cannot iterate over a non-iterable typeE0103: Cannot determine a type of enum to fetchE0104:mainfunction cannot have parametersE0105:mainfunction cannot have a return type, to return a value useos.exit()E0106:nonecan be cast only to an Option typeE0107: Option propagation can only be used with Option typesE0108: Option propagation can only be used in function that returns an Option typeE0109: Cannot infer a type of arrayE0110:T{}initialization is only allowed for structs, aliases for structs, arrays, maps, and channelsE0111: Included file not found by C compilerE0112: Access to.dataof string literal can be replaced with C string (warning)E0113: Complex boolean expression should use parenthesesE0114: Unused import (warning)E0115: Shadowing of importnameE0116: Go-style cast is not supportedE0117: C binding arguments count mismatchE0118: Deferred expression must be a function callE0119: Duplicate field namenameE0120: Cannot cast rune literal tou8, usebprefix to create a byte literalE0121: Comparison of unsigned integers with zero is always true or false (warning)E0122: Cannot cast a pointer to a reference typeE0123: Cannot cast&voidoutsideunsafeblockE0124: Not enough information to infer a type of lambda parameterE0125: Unnecessary parentheses forifcondition (warning)E0126:ifexpression must haveelsebranchE0127: Division or modulo by zeroE0128: Cannot infer a type of generic parameter in callE0129: Cannot increment or decrement expression of typeE0130: C binding functions cannot have a bodyE0131: Cannot infer a type of generic parameter in type instantiationE0132: Unsupported compile-time conditionE0133: Cannot use a type in string interpolation because it does not havestrmethodE0134: Cannot find modulenameto importE0135: Cannot access private elementnamefrom modulenameE0136: Cannot have a second variable inforloop over rangeE0137: Cannot cast a type to interfacenamebecause it does not implement itE0138: Unpacking expression must be the last argument in the callE0139: Only arrays can be unpackedE0140: Unpacking in array initializer is not allowedE0141:ischeck is always false or true because a type not implements interfaceE0142: Right operand ofisoperator must be a struct, interface, union or type aliasE0143: Impliciterrvariable can be used only whenorblock used forResultE0144: Cannot take mutable reference to immutable variableE0145: Cannot assign to immutable variableE0146: Cannot break/continue to label since label is not directly attached to any enclosing loopE0147:!operator can be used only withbooltypeE0148:||and&&operators can be used only withbooltypeE0149: Cannot cast an immutable pointer to mutable oneE0150: Whenoris used as an expression, it must have expression in the blockE0151: Cannot unpack expression as i-th argument in functionE0152: Spawn expression must be a function callE0153: Forbidden castE0154: Integer literal too big to fit ini32typeE0155:ifexpression body must end with expression,returnstatement orbreak/continueE0156: Emptymatchexpression (warning)E0157:matchexpression with onlyelsebranch is not allowedE0158:matchexpression with type arms can only be used with interface or union typesE0159:matcharm expressions cannot have both types and values in the same armE0160: Cannot match typenamebecause it is not implemented interface frommatchexpressionE0161:matchexpression for enums must be exhaustiveE0162:matchexpression already matches all variants of enumE, soelsebranch is never executedE0163: Unnecessary parentheses formatchexpression (warning)E0164: Expression matched several times inmatchexpressionE0165:matchexpression body must end with expression,returnstatement orbreak/continueE0166:ifcondition must haveboolE0167: Cannot break/continue to label since label is outside current function literalE0168: Unnecessary parentheses forforstatement (warning)E0169: Cannot increment or decrement immutable variableE0170: Assignment count mismatchE0171: Cannot unpack non-tuple typeE0172: Tuple type does not have any fields or methodsE0173: Wrong variable name in declarationE0174: Cannot call static interface methodE0175: Cannot assign barenoneto variable, cast it to a concrete Option type firstE0176: Cannot assign to expr because it is not a lvalueE0177: Cannot declare variable_, this name is reserved for placeholdersE0178: Cannot assign barenilto variable, cast it to a concrete pointer type firstE0179: Placeholder_cannot be mutableE0180: Wrong usage of placeholderE0181: Cannot inc/dec non-lvalue expressionE0182: Placeholder_is not needed here (warning)E0183: Placeholder_is invalid hereE0184: Unpacking expression is only allowed in function call or type initializerE0185: Cannot access to fields for interfacesE0186:.str()can be omitted in string interpolation because it is called implicitly (warning)E0187: Variable in range expression cannot be mutableE0188: Cannot get tuple element with indexibecause tuple has onlynelementsE0189: Index of tuple must be a constant integerE0190: Test name must be string literalE0191: Test declaration cannot have a signatureE0192: Array initializer must have zero or one parameterE0193: Array initializer must be a lambda expressionE0194: Array initializer parameter must haveusizetypeE0195: Cannot receive from a non-Channel typeE0196: Cannot receive from a non-Channel typeE0197: Onlycapfield can be specified for a Channel typeE0198: Onlylen,capandinitfields can be specified for an Array typeE0199: Onlycapfield can be specified for a Map typeE0200: Duplicate embedded interfaceE0201: Embedded type in interfaces must be identifier, selector expression, or generic version of themE0202: Only interfaces can be embedded in interfaceE0203: Embedded interface X causes conflict for method YE0204: Result propagation can only be used with Result typesE0205: Result propagation can only be used in function that returns a Result typeE0206: Enum variant out of range for a backed typeE0207: Enum backed type must be one ofu8,u16,u32,u64,i8,i16,i32,i64E0208: Array index must be of typeusizeE0209: Onlyinitandno_initfields can be specified for a fixed array typeE0210: Unused return value of functionnamethat must be usedE0211: Cannot evaluate constant expressionE0212: Duplicate enum valueE0213: Union type should have at least two typesE0214: Cannot call static method via instanceE0215: Cannot call instance method as staticE0216: Operator is not defined for a typeE0217: Cannot cast expression to Union because it's not one of its typesE0218: Right operand ofisoperator is not a member of the union typeE0219: Import names must have at least one nameE0220: Assert condition must havebooltypeE0221: Assert message must havestringtypeE0222: Function has no parameter with such a nameE0223: Positional argument after named argument is not allowedE0224: Duplicate named argumentE0225: Cannot access field of a pointer outside unsafe blockE0226:mutexpression can be used only in variable declarationE0227: Inclusive range..=always panic in runtime due out of rangeE0228:offset_ofargument must be a string literalE0229: Cannot get offset of non-struct type fieldE0230: Cannot get field offset of unknown fieldE0231: Cannot access field of C-style union struct outside unsafe blockE0232: Cannot initialize more than one field of C-style union structE0233: Cannot clone C-style union structE0234: Clone expression does not have any effect, because all fields are already initializedE0235: Explicit Option propagation can be safely removed in return expressions (warning)E0236:or { return none }can be safely removed in return expressions (warning)E0237: Explicit Result propagation can be safely removed in return expressions (warning)E0238: Cannot use safe access on a non-Option typeE0239: Cannot unpack Option/Result tuple, you need to unwrap an Option/Result type firstE0240:matchexpression for unions must be exhaustiveE0241:matchexpression already matches all members of unionU, soelsebranch is never executedE0242: Cannot cast a union type to another type because it's not one of its typesE0243: Cannot access enum variant via expressionE0244: Cannot match typenamebecause it is not member of a union typeE0245: Add#[typedef]attribute to C structE0246: Cannot cast an immutable reference to mutable oneE0247: Match expression must haveelsebranchE0248: Enum variant value must have one of the following types:E0249: Cast is always successful, useasinstead ofas?E0250: Select expression with single timeout arm is not allowedE0251: Invalid expression in select armE0252: Select expression with only timeout and else arm is not allowed, add at least one non timeout/else armE0253: Invalid statement in select arm, expected send, assign, var declaration or expression statementE0254: Statement in select handled more than onceE0255: Select expression with only else arm is not allowed, add at least one non timeout/else armE0256: Reachingunwrap()call will always panicE0257: Checking expression fornoneis always true/falseE0258: Cannot use?.to access module membersE0259: Cannot create instance of generic typeTwithoutreflection.StructconstraintE0260: Compiler error function call is reachedE0261: Compiler warning function call is reached (warning)E0262:compiler_errorandcompiler_warningfunctions must have a string literal argumentE0263: Generic argument name in the method receiver must be an identifierE0264: Cannot shift value of typeTbyXbits, maximum shift value isYE0265: Result of compile time constant folding overflows the maximum value of typeTE0266: Cannot shift value of typeTbyXbits, shift count is negativeE0267: Enum variant value overflow for typeTE0268: Cannot iterate with mutation over immutable stringE0269: Cannot iterate with mutation over a channelE0270: Left and right operands ofisoperator are the same type, so this check is always true (warning)E0271: Test files should be defined withmainmodule name for nowE0272: Cannot slice a non-array and non-string typeE0273: Result type returned from function must be used