meta-function confuses typing of default arrow
Opened this issue · 4 comments
The following signature causes various explicated rules on default arrow to mis-typed expecting to see Index instead of V
signature
sort aliases
Index = Map(Int, Int)
variables
I : Index
constructors
ArrayV : Index -> V
arrows
initArray(Int, Int, V, Index) --> Index
For example,
E E1 |- __LValue2Exp__(lv1) :: H H1 -default-> v1 :: H H3
where
E E1 |- lv1 :: H H1 -lval-> a1 :: H H2;
read(a1) :: H H2 -default-> v1 :: H H3.
This rule has a type error in the explicated code.
Running the generated interpreter leads to class cast exception.
There should be no confusion between arrow for meta-function and default arrow.
This is probably due to the overloading of the Index sort.
Index was already used as sort in the syntax definition to deal with an ambiguity of the Subscript construct:
Index = Exp
This caused a whole bunch of confusion in the type checker by equating Exp and Map(Int, Int).
While the problem is solved for me, the diagnosis should be improved.
What were the errors/warnings that you did receive and what would you have liked different?
It is an error to define a sort alias to a primitive type (Int, Map, etc.) if the sort is also used as a syntactic sort (i.e. as target sort for a constructor declaration).