Fix #6900: Support chained polymorphic extension methods #6901
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Given a tree
qual.foo
, when we typecheckqual
we now that the resultmust have a member named
foo
, if it doesn't we'll try to adapt itthrough 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 weperform the conversion on
qual
we actually now more about the memberfoo
: it must have a member namedbar
. However in general we cannotuse this information: this member might actually require another
conversion and as a rule we don't chain conversions. Therefore, we need
to ignore the expected type of
foo
, this is implemented byProtoTypes#selectionProto
wrapping the expected member type inIgnoredProto
.However, the following failed before this commit:
This happens because when
Applications#extMethodApply
extracts thetype arguments of the extension method from its expected type, it might
end up unpealing an
IgnoredProto
. The solution is to rewrap the newexpeted type into an
IgnoredProto
if the original was ignored.