Skip to content

Point to declarations in diagnostics #138

@syldium

Description

@syldium

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyzerThe scope is related to the analyzergood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions