Closed DavePearce closed 7 years ago
This is now done, though it's pretty clear that I don't know how to properly implement an instance of SubtypeOperator
at this time.
See #65 for potential solution. Apparently, I do know since the WhileyCompiler already solves this problem :)
There is a problem with the meaning of
SubtypeOperator.isSubtype()
. Specifically, there are really three cases it should handle:int|null :> int
is definitely true.int :> int|null
is definitely false.nat :> pos
is unknown. More specifically, whilst the underlying or raw types are subtypes (i.e. int :> int), we cannot be so sure about the actual types because of their type invariants. That is, we cannot reason within the type checker that the invariant fornat
implies that forpos
.At the moment, the subtype operator only provides binary information and, hence, cannot describe the third case.