Compatibility
A trait defining an isCompatible
method.
A trait defining an isCompatible
method.
Value members
Abstract methods
Concrete methods
Check that the result type of the current method fits the given expected result type.
Check that the result type of the current method fits the given expected result type.
Constrain result with special case if meth
is an inlineable method in an inlineable context.
In that case, we should always succeed and not constrain type parameters in the expected type,
because the actual return type can be a subtype of the currently known return type.
However, we should constrain parameters of the declared return type. This distinction is
achieved by replacing expected type parameters with wildcards.
Constrain result with special case if meth
is an inlineable method in an inlineable context.
In that case, we should always succeed and not constrain type parameters in the expected type,
because the actual return type can be a subtype of the currently known return type.
However, we should constrain parameters of the declared return type. This distinction is
achieved by replacing expected type parameters with wildcards.
A type tp
is compatible with a type pt
if one of the following holds:
A type tp
is compatible with a type pt
if one of the following holds:
tp
is a subtype ofpt
pt
is by name parameter type, andtp
is compatible with its underlying type- there is an implicit conversion from
tp
topt
. tp
is a numeric subtype ofpt
(this case applies even if implicit conversions are disabled) Ifpt
is a by-name type, we compare against the underlying type instead.
Like normalize and then isCompatible, but using a subtype comparison with necessary eithers that does not unnecessarily truncate the constraint space, returning false instead.
Like normalize and then isCompatible, but using a subtype comparison with necessary eithers that does not unnecessarily truncate the constraint space, returning false instead.