Skip to content

Provide hints on failed unification errors #514

@ghallak

Description

@ghallak

In the following example contract:

contract C =
    entrypoint f(x) =
        let s = "str1"
        let t = "str2"
        let c = s + t
        c

The type checker will produce the error message:

type_error: Cannot unify `string` and `int`
At: Line 3, column 13

The error message does not give any hints on why it's trying to unify a string with an int, especially that it doesn't mention line 5, where s is the left hand side of the + operator, which is expected to be an int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions