Closed Jozott00 closed 2 years ago
Could we before we flat() them check if they have intersecting values?
Nope, since we have to flat the superclass before we can check against intersecting values... flat() is a recursive function which calls flat() on the superclass before checking for other stuff.
So for example
does not crash. This is because we
flat()
all classes in theClassStatement
typechecker. Since we callflat()
onA
before we typecheckedB
(and therefore determine its superclass), we could not seea: Int
inB
, and therefore cannot check the type.I guess we need a third pass, that runs through and flats all classes after each class has its superclass typechecked.