- #print "{class_name}: {self}/{mtype}/{anchor} -> {self}/{resolved_reciever}/{anchor} -> {verbatim_bound}/{mtype}/{anchor} -> {res}"
-
- # What to return here? There is a bunch a special cases:
- # If 'cleanup_virtual' we must return the resolved type, since we cannot return self
- if cleanup_virtual then return res
- # If the reciever is a intern class, then the virtual type cannot be redefined since there is no possible subclass. self is just fixed. so simply return the resolution
- if resolved_reciever isa MNullableType then resolved_reciever = resolved_reciever.mtype
- if resolved_reciever.as(MClassType).mclass.kind == enum_kind then return res
- # If the resolved type isa MVirtualType, it means that self was bound to it, and cannot be unbound. self is just fixed. so return the resolution.
- if res isa MVirtualType then return res
- # If we are final, just return the resolution
- if is_fixed(mmodule, resolved_reciever) then return res
- # It the resolved type isa intern class, then there is no possible valid redefinition is any potentiel subclass. self is just fixed. so simply return the resolution
- if res isa MClassType and res.mclass.kind == enum_kind then return res
- # TODO: Add 'fixed' virtual type in the specification.
- # TODO: What if bound to a MParameterType?
- # Note that Nullable types can always be redefined by the non nullable version, so there is no specific case on it.