You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixscala#6900: Support chained polymorphic extension methods
Given a tree `qual.foo`, when we typecheck `qual` we now that the result
must have a member named `foo`, if it doesn't we'll try to adapt it
through implicit conversion / extension method selection to something
which does have such a member.
Given a tree `qual.foo.bar`, the same process happens, but when we
perform the implicit conversion on `qual` we actually now more about
the member `foo`: it must have a member named `bar`, however in general
we cannot use this information: this member might actually require
another conversion and we don't chain conversions as a rule. Therefore,
we need to ignore the expected type of the member, this is implemented
by `ProtoTypes#selectionProto` wrapping the expected member type in
`IgnoredProto`.
However, the following failed before this commit:
given bla[A] { def (a: A) foo[C]: C => A = _ => a }
1.foo[String].foo[String]
This happens because when `Applications#extMethodApply` extracts the
type arguments of the extension method from its expected type, it might
end up unpealing an `IgnoredProto`. The solution is to rewrap the new
expeted type into an `IgnoredProto` if the original was ignored.
0 commit comments