Skip to content

Add syntax aware contexts to errors #145

@Marwes

Description

@Marwes

We should have better, more human readable error messages. Elm has had a fair amount of praise for its error messages so stealing some ideas from it should be a good idea http://elm-lang.org/blog/compiler-errors-for-humans. From the blog post we can see that the error messages contain not only row and column information about where the error occurs but also that the error occurred in the 1st argument.

To do this we may add an enum as below in addition the the current Span which would meaning changing the signature of unify_span to take an AstLocation as well which each caller needs to supply with the extra information (which might need to be optional, at least to start with).

enum AstLocation {
    Argument { position: u32 },
    Array { position: u32 },
    Pattern { position : .. },
    IfElsePredicate,
    // ... more
}

This can be a bit bigger project but just adding a few AstLocation's may be good starting project.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions