Carp icon indicating copy to clipboard operation
Carp copied to clipboard

Can't use type names without fully qualifying them

Open TimDeve opened this issue 5 years ago • 3 comments

Tried to build an old project and it now fails because referring to types without fully qualifying them is not possible.

Use to work:

(defmodule Mod
 (deftype Ok [a Int])
 (deftype NotOk [a Ok]))

What is needed now:

(defmodule Mod
 (deftype Ok [a Int])
 (deftype NotOk [a Mod.Ok]))

TimDeve avatar Mar 09 '21 13:03 TimDeve

Thanks! This is due to the fact that we actually support module encapsulation of types now. Before the original code was really adding Ok and NotOk to the global type environment even though the calls occur in Mod, whereas now it actually adds it to Mod. The only problem is the type lookup isn't taking the current context path into account.

scolsen avatar Mar 09 '21 14:03 scolsen

Ok so what you are saying is that declaring my types at the top level should actually be equivalent to the previous behaviour?

TimDeve avatar Mar 09 '21 16:03 TimDeve

Yes, if you declare them outside the module it should work as expected.

scolsen avatar Mar 09 '21 16:03 scolsen