enso icon indicating copy to clipboard operation
enso copied to clipboard

Fully Qualified Names are not allowed in type signatures

Open radeusgd opened this issue 1 year ago • 0 comments

Repro:

from Standard.Base import all

foo : Standard.Base.Data.Numbers.Integer
foo = 1

bar (x : Standard.Base.Data.Numbers.Integer) = 10+x

main =
    bar foo

This seems like a completely valid program, but it fails to compile with:

X:\NBO\repr\test3.enso:3:7: error: The name `Standard.Base.Data.Numbers.Integer` could not be found.
    3 | foo : Standard.Base.Data.Numbers.Integer
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
X:\NBO\repr\test3.enso:6:10: error: The name `Standard.Base.Data.Numbers.Integer` could not be found.
    6 | bar (x : Standard.Base.Data.Numbers.Integer) = 10+x
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aborting due to 2 errors and 0 warnings.
Execution finished with an error: Compilation aborted due to errors.

If I replace the FQNs with just Integer it runs all fine.

I don't see any reason why FQNs should not be allowed in type signatures. In fact it is rather confusing.

Note that the exact same FQN used as value works all fine:

from Standard.Base import all

main =
    IO.println Standard.Base.Data.Numbers.Integer
    IO.println (42.is_a Standard.Base.Data.Numbers.Integer)

printing

Integer
True

radeusgd avatar Feb 07 '24 17:02 radeusgd