aeternity / aesophia

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

Error when trying to unify `(unit) => 'a` and `() => int` #370

Closed ghallak closed 2 years ago

ghallak commented 2 years ago

The following code shows an error unless function f() : int is changed to function f(_ : unit) : int:

main contract Main =
    datatype y('a) = Y(unit => 'a)

    function f2() : int = 1

    entrypoint ss() =
        let yv : y(int) = Y(f2)
        ()
UlfNorell commented 2 years ago

That's expected. (unit) => 'a and () => 'a are different. The first is a function with one argument and the second a function with zero arguments. If you want to keep f2 as it is you have to change y to datatype y('a) = Y(() => 'a)