Compiler error codes
Every compiler message (information, warning or error) has a unique error code that is used to identify the issue causing the message. The following table lists all error codes emitted by the Dassie compiler along with a code example causing the error and a way to fix it.
| Code | Type | Cause | Code example | Fix |
|---|---|---|---|---|
| DS0000 | Error | Internal compiler error. This error is thrown if an unhandled exception occurs in the compiler. When you encounter this error, please open an [issue](https://github.com/loschsoftware/dc/issues) in this repository. | ||
| DS0001 | Error | Emitted when the parser encounters syntactically incorrect source code. |
println "Hello World! # DS0001
|
The code throws DS0001 because the string literal is not closed. Add another quotation mark at the end to fix it. |
| DS0002 | Error | Emitted when a function or method is called with illegal arguments, or if an operator is not defined for the specified types. |
x = 2 y = true z = x + y # DS0002 |
Call the function with the correct argument types, or find a conversion that allows the operator to be called. |
| DS0006 | Error | Emitted when a value of the wrong type is assigned to a variable. |
var x = 2 x = 2.5 # DS0006 |
Assign a value of the correct type or convert the value to the correct type. |
| DS0009 | Error | Emitted when a referenced name cannot be resolved. Often caused by missing import directives. |
Console.WriteLine "Hello World!" # DS0009 |
Import the 'System' namespace. |
| DS0018 | Error | Emitted when an immutable value is being reassigned. |
x = 2 x = 3 # DS0018 |
Mark the value as mutable using var. |
| DS0022 | Error | Emitted when an assembly referenced in dsconfig.xml does not exist. |
<!--DS0022-->
<AssemblyReference>NonExistent.dll</AssemblyReference>
|
Correct the file path to make sure the file exists. |
| DS0023 | Error | Emitted when a file referenced in dsconfig.xml does not exist. |
<!--DS0022-->
<FileReference>NonExistent.png</FileReference>
|
Correct the file path to make sure the file exists. |
| DS0027 | Error | Emitted when the program contains no executable code. |
# DS0027 |
Add some code to the program. |
| DS0029 | Error | Emitted when the compiler has insufficient permission to read a file. | Make sure the compiler has permission to read the file. | |
| DS0030 | Error | Emitted when the program has no entry point. |
# DS0030
module Program = {
Main (): int32 = {
println "Hello World!"
0
}
}
|
Mark Main with the <EntryPoint> attribute |
| DS0035 | Error | Emitted when the application entry point is not static. |
type Program = {
<EntryPoint>
Main (): int32 = { # DS0035
println "Hello World!"
0
}
}
|
Mark Main with the static modifier. |
| DS0036 | Error | Emitted when a comparison operator is not implemented for the specified types. |
x = 2 y = "text" z = x < y # DS0036 |
Use a different operator or convert one of the operators to an allowed type. |
| DS0038 | Error | Emitted when the condition of a conditional expression is not a boolean. |
? x = 2 = { # DS0038
println "x is equal to 2."
}
|
Change the type of the condition or fix a typo. |
| DS0041 | Error | Emitted when an array or list contains multiple types of values. |
items = @[ 1, 2, 3.5, 4 ] # DS0041 |
Use only one type of value in the list or use a tuple. |
| DS0042 | Error | Emitted when trying to index into an array or list with a value that is not an integer. |
items = @[ 1, 2, 3 ] println items::"a" # DS0042 |
Only use integers as indices on arrays and lists. |
| DS0043 | Warning | Warning emitted when a while loop runs indefinetly, possibly on accident. |
@ "x" = { # DS0043
println "Loop"
}
|
Fix the loop condition if the loop was not intended to run indefinetly. Otherwise, the warning can be ignored. |
| DS0045 | Error | Emitted when an inline IL instruction uses an invalid CIL opcode. |
il "ldc.j4.s 23" # DS0045 |
Use a valid IL opcode. |
| DS0047 | Warning | Warning emitted when a union type contains duplicate cases. |
x: (string | string) = () # DS0047 |
Remove duplicate cases from the union type. |
| DS0048 | Error | Emitted when a source file to be compiled does not exist. |
dc file.ds # DS0048 |
Make sure the path to the source file is correct. |
| DS0050 | Error | Emitted when the return type of an auto-generated entry point is not 'int32' or 'null'. |
println "Hello World!" "Goodbye" # DS0050 |
Ensure the last expression in the program is of type 'int32' or 'null'. |
| DS0052 | Error | Emitted when a type member has a modifier that is invalid in the current context. |
type Point = {
closed X: int32 # DS0052
closed Y: int32 # DS0052
}
|
Remove or replace the invalid modifier. |
| DS0053 | Error | Emitted when a type member returns a different type than specified. |
type Worker = {
DoWork (): int32 = {
"Done" # DS0053
}
}
|
Change the return type to match returned expression. |
| DS0054 | Error | Same as DS0053, but for fields. |
type Point = {
X: int32 = 2.5 # DS0054
}
|
Change the type of the field to its default value. |
| DS0055 | Error | Emitted when a program contains multiple methods marked as <EntryPoint>. |
module App = {
<EntryPoint>
Main1 (): null = {}
|
Remove the <EntryPoint> attribute from all but one of the methods. |
| DS0056 | Error | Emitted when a symbol referenced inside a code block cannot be resolved. |
y = 10 println x # DS0056 |
Make sure the referenced symbol exists. Correct a typo if necessary. |
| DS0057 | Error | Emitted when a variable with a type annotation is initialized with a value of the wrong type. |
x: int32 = 2.5 # DS0057 |
Correct the type annotation or assigned value. |
| DS0058 | Information | Emitted when a type or member specifies a modifier that is applied by default. |
module Tools = {
static Tool1 = {} # DS0058
}
|
Remove the redundant modifier. |
| DS0059 | Error | Emitted when the throw keyword is used without arguments outside of a catch block. |
throw # DS0059 |
Add an exception to throw or move the statement into a catch block. |
| DS0060 | Error | Emitted when the throw keyword is used to throw a value type. |
throw 3.14 # DS0060 |
Box the value to be thrown. |
| DS0061 | Error | Emitted when a try block is not immediately followed by a catch block. |
try = {
DangerousCall
} # DS0061
|
Add a catch block. |
| DS0063 | Error | Emitted when trying to use a feature that is in development, but not yet supported by the compiler. | Fall back to an alternative. | |
| DS0064 | Error | Emitted when trying to use a try block as an expression. |
x = try = {} # DS0064
|
Don't use try as an expression. |
| DS0065 | Error | Emitted when the left side of an assignment is invalid. | 4 = 5 # DS0065 |
Make sure the left side of the assignment is a symbol. |
| DS0067 | Error | Emitted when a referenced resource file does not exist. | <!-- DS0067 -->
<ManagedResource>invalid.txt</ManagedResource>
|
Make sure the referenced file exists. |
| DS0069 | Error | Emitted when an external tool required to perform an action is not installed. | Install the required external component. | |
| DS0070 | Information | Emitted when the <VersionInfo> tag is used in a project file. |
<!-- DS0070 -->
<VersionInfo/> |
The usage of this tag worsens compilation performance. To decrease compile times, pre-compile your version information and reference it as a native resource. |
| DS0071 | Warning | Emitted when an error code is ignored that cannot be ignored. | <IgnoredMessages>
<!-- DS0071 -->
<Message>DS0065</Message>
</IgnoredMessages> |
Remove or correct the ignored error code. |
| DS0072 | Error | Emitted when dc build is called but there are no source files in the current folder structure. |
Make sure the current folder structure contains source files ending in .ds. |
|
| DS0073 | Error | Emitted when the length of a fully-qualified type name exceeds 1024 characters. | # Just imagine the ellipsis
# representing a very long string
type ThisIsAVeryLong...Name = {} # DS0073 |
Reduce the length of the type name. |
| DS0074 | Error | Emitted when a function or member contains more than 65534 locals. | x = 0 y = 0 z = 0 . . . zzzzzzzzzzzzzz = 0 # DS0074 |
Reduce the amount of locals in the function. |
| DS0075 | Error | Emitted when the value of a local exceeds the largest allowed value of its type. | x: int32 = 2147483648 # DS0075 |
Use a larger type. |
| DS0076 | Error | Emitted when a character literal is left empty. | c = '' # DS0076 |
Fill the literal with a character. |
| DS0077 | Error | Emitted when attempting to import something other than namespaces or modules. | # DS0077 import System.IO.TextWriter |
Only import namespaces and modules. For types, you can set an alias instead. |
| DS0078 | Warning | Emitted when an access modifier group uses the default modifier for the containing type. | type Point = {
global = { # DS0078
X: int32
Y: int32
}
} |
Remove the redundant modifier group. |
| DS0079 | Error | Emitted when an array has more than 32 dimensions. | # DS0079 arr: int@[,,,...,] = () |
Reduce the amount of dimensions or use an alternative data structure. |
| DS0081 | Error | Emitted when there are problems with the project file of a referenced project. | Fix all problems as suggested by the individual error message. | |
| DS0082 | Warning | Emitted when a macro that does not exist is used in a project file. | $(TimeExakt) # DS0082 |
Make sure the spelling of the macro is correct, or add a definition for the macro. |
| DS0083 | Error | Emitted when the modifier var is used on a method. |
type Tools = {
# DS0083
var Print (msg): null = {
println msg
}
} |
Remove the modifier. Methods are never mutable. |
| DS0084 | Error | Emitted when attempting to access this from inside a static method. |
module M = {
F (): null = {
this.x = 2 # DS0084
}
} |
Remove the reference to this or convert the member to an instance method. |
| DS0085 | Error | Emitted when a type symbol cannot be associated with any internal compiler data. | This error code indicates a bug in the compiler. If you encounter this error, please open an issue. | |
| DS0087 | Error | Emitted when calling dc build with a build profile that does not exist. |
dc build Profile01 # DS0087 |
Make sure the specified profile exists. |
| DS0089 | Warning | Emitted when a property set in dsconfig.xml does not exist. |
<!-- DS0089 -->
<RotNamespace>App</RotNamespace> |
Fix the spelling of the property. |
| DS0090 | Error | Emitted when a project file is either syntactically or semantically malformed. | <!-- DS0090 -->
<DassieConfig FormatVersion="1,0"/> |
Make sure the project file is syntactically correct XML and the format version is a correct version string. |
| DS0091 | Error | Emitted when a project file uses a newer format than supported by the current compiler version. | <!-- DS0091 -->
<DassieConfig FormatVersion="2.0"/> |
Update the compiler or downgrade to an older project file format. |
| DS0092 | Warning | Emitted when a project file uses an outdated format. | <!-- DS0092 -->
<DassieConfig FormatVersion="0.0"/> |
Update the file format. |
| DS0093 | Error | Emitted when a constructor has a return value. | type Point = {
X: int32
Y: int32
#DS0093
Point (x: int32, y: int32) = {
X = x
Y = y
}
} |
Remove the return value. Use ignore to discard a value. |
| DS0094 | Error | Emitted when a field marked as read-only using the val keyword is modified outside of a constructor. |
type Point = {
val X: int32
val Y: int32
Point (x: int32, y: int32) = ignore {
X = x
Y = y
}
}
module App = {
<EntryPoint>
Main (): int = {
point = Point 10, 20
point.X = 30 # DS0094
0
}
} |
Remove the assignment or remove the val modifier from the field. |
| DS0095 | Error | Emitted when a an immutable symbol is passed by reference. | module App = {
Test (var x: int32&): null = ignore {
x += 1
}
|
Mark the symbol as mutable using the var keyword. |
| DS0096 | Error | Emitted when a symbol is passed by reference without the '&' operator. | module App = {
Test (var x: int32&): null = ignore {
x += 1
}
|
Use the & to pass the symbol by reference. |
| DS0097 | Error | Emitted when an illegal expression is passed by reference. | module App = {
Test (var x: int32&): null = ignore {
x += 1
}
|
Only assignable symbols can be passed by reference. Assign the value to a local variable before passing it by reference. |
| DS0098 | Error | Emitted when a scratch cannot be found. | Check if the name was spelled correctly. | |
| DS0099 | Warning | Emitted when multiple installed extensions define a command with the same name. | Remove all but one of the duplicate extensions. |