-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Diagnostics are contextualized errors, that point the relevant code spans.
Observation::here is important, probably as important as giving where the declaration happened. When an immutable variable is reassigned twice for instance, it would be nice to point that the variable definition may be changed by replacing the val keyword for var.
Giving this help might not always be useful when defined in an external library, so the focus here would be to expand the error context by indicating where the symbol is declared.
Function parameters are already mapped to their span in the source code, this issue will require doing the same when collecting the symbols. This could be stored in the Variables struct, populated through the Environment struct during the collection phase.
The diagnostics can then be updated:
val constant = 0
constant = 1 // Immutable variable assigned twice
constant() // Invoking non function type
fun foo() = {}
foo($constant) // Incorrect parameter count