Closed mbenke closed 2 months ago
Another, possibly related problem with instances: in the contract test/examples/NegPair.solc
the typechecker outputs
instance (a : Neg, b : Neg =>) Pair[a, b] : Neg {
function neg (p : Pair[a19, a20]) {
return Pair[neg(fst(p)), neg(snd(p))]
}
}
where I think should be function neg (p : Pair[a, b])
IOW it seems neg
gets too general (and incorrect) type - forall a19 a20. Pair[a19, a20] -> Pair[a19, a20]
rather than forall a: Neg, b: Neg. Pair[a,b] -> Pair[a,b]
.
Fixed on last commit in main.
Consider the following simple class/instance:
This fails to typecheck with:
OTOH typechecks fine if
fromEnum
is ordinary function rather than a class method.