Skip to content

Fix argument emission for extension methods on InvocationExpression t…#260

Open
theolivenbaum wants to merge 1 commit intomasterfrom
fix-extension-method-invocation-args-10142037046178726753
Open

Fix argument emission for extension methods on InvocationExpression t…#260
theolivenbaum wants to merge 1 commit intomasterfrom
fix-extension-method-invocation-args-10142037046178726753

Conversation

@theolivenbaum
Copy link
Collaborator

…arget

Modified InvocationBlock.WriteThisExtension to explicitly handle MemberReferenceExpression targets by visiting the Target property. This prevents incorrect emission (stripping of arguments) when the receiver of an extension method call is itself an InvocationExpression (e.g., Method().Extension()), which previously relied on brittle Children.ElementAt(0) logic.

Added regression test Tests/H5.Compiler.IntegrationTests/Language/ExtensionMethodInvocationTest.cs.

…arget

Modified `InvocationBlock.WriteThisExtension` to explicitly handle `MemberReferenceExpression` targets by visiting the `Target` property. This prevents incorrect emission (stripping of arguments) when the receiver of an extension method call is itself an `InvocationExpression` (e.g., `Method().Extension()`), which previously relied on brittle `Children.ElementAt(0)` logic.

Added regression test `Tests/H5.Compiler.IntegrationTests/Language/ExtensionMethodInvocationTest.cs`.

Co-authored-by: theolivenbaum <8791811+theolivenbaum@users.noreply.github.com>
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.

1 participant