Skip to content

Keep implicit Me receiver for extension calls - #3

Closed
GrahamTheCoder wants to merge 2 commits into
masterfrom
claude/dreamy-meitner-iekdwa
Closed

GrahamTheCoder wants to merge 2 commits into
masterfrom
claude/dreamy-meitner-iekdwa

Conversation

@GrahamTheCoder

Copy link
Copy Markdown
Owner

Summary

An extension call on an implicit Me dropped the receiver: in a class inheriting List(Of Integer), Distinct().ToList() became Enumerable.Distinct().ToList() (CS1501).

Two causes in VbNameExpander:

  1. IsTypePromotion treated the outer reduced-extension access (.ToList) as type promotion, so the whole access was replaced by its receiver and the inner Distinct was never expanded. Reduced extensions are now excluded.
  2. The enclosing-type check used a class-only 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

…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
@GrahamTheCoder

Copy link
Copy Markdown
Owner Author

Superseded: icsharpcode#1309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants