aeternity / aesophia

Stand alone compiler for the Sophia smart contract language
https://docs.aeternity.com/aesophia
ISC License
52 stars 19 forks source link

Provide hints on failed unification errors #514

Open ghallak opened 3 weeks ago

ghallak commented 3 weeks ago

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.

nikita-fuchs commented 3 weeks ago

that would be a great help !