Javadoc
The main implementation of the subtype checker. If "a" and "b" are the same object the result is "yes"; if either
is an
UnknownType, we are dealing with earlier parser errors and so "yes" is returned to avoid too many
errors; if either is a
ParameterType the result is also "yes" on the grounds that the type cannot be
tested at compile time. If either type is a
BracketType or a
NamedType the types are reduced to
their underlying type before proceeding; if either is an
OptionalType and the other is optional also, the
result is "yes", otherwise the underlying type of the optional type is taken before proceeding; the last two
steps are repeated until the types will not reduce further. To compare the reduced types, if "a" is a union type,
then all the component types of "a" are compared to "b" (or b's components, if it too is a union type); otherwise
basic type comparisons are made, involving any subtypes - for example, if they are both sets, then the result
depends on whether their "set of" subtypes are subtypes, by a recursive call. Similarly with maps and sequences,
function/operation parameter types, and record field types. Lastly, a simple
org.overture.vdmj.types.Type#equals operation is performed on two basic types to decide the result.