Repository navigation
Keep implicit Me receiver for extension calls - #3
Closed
GrahamTheCoder wants to merge 2 commits into
Closed
GrahamTheCoder wants to merge 2 commits into
GrahamTheCoder wants to merge 2 commits into
Conversation
…ion access A reduced extension method access such as Distinct().ToList() was treated as type promotion, so the whole access was replaced by its receiver and the implicit Me of the inner Distinct() was never expanded, giving Enumerable.Distinct(). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019FEr8Ewvos6pJ4xv426Vsc
The enclosing-type check for a reduced extension used a base-class-only InheritsFromOrEquals, so extensions on interfaces such as IEnumerable(Of T).Distinct() inside a class deriving List(Of T) were not given Me. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019FEr8Ewvos6pJ4xv426Vsc
Owner
Author
|
Superseded: icsharpcode#1309 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
An extension call on an implicit
Medropped the receiver: in a class inheritingList(Of Integer),Distinct().ToList()becameEnumerable.Distinct().ToList()(CS1501).Two causes in
VbNameExpander:IsTypePromotiontreated the outer reduced-extension access (.ToList) as type promotion, so the whole access was replaced by its receiver and the innerDistinctwas never expanded. Reduced extensions are now excluded.InheritsFromOrEquals, so interface receivers (IEnumerable<T>) never matched. It now includes interfaces.Output is now
this.Distinct().ToList().Needs attention
Full-suite comparison against the baseline is still in progress. A run before the second fix showed 31 failures (30 look environmental: solution-file/MultiFile, TypeCast, XML/string, enum tests; 1 was the new test). Will update once the final run is compared.
Tests
New conversion test
ExtensionMethodTests.ImplicitMeExtensionCallKeepsReceiverAsync. Extension, Linq and access-expression tests pass (149).Generated by Claude Code