Skip to content

Conversation

@exyi
Copy link
Contributor

@exyi exyi commented Jan 24, 2026

Sorry, I tried fixing one NewExpression issue and it snowballed a bit.

I'm not sure how exactly ParentFlags is supposed to be used, and therefore unsure if my fix is right. However, TryEmitMethodCall does not propagate any flags to its arguments, so it makes sense that TryEmitNewExpression shouldn't do that either. The rest of the changes in TryEmitNewExpression is just handling of InstanceAccess and IgnoresResult parent flags.

The removed | ParentFlags.Ctor at 5084 seemed just like alternative solution for issue 333, which is now handled by not propagating InstanceAccess flag to constructor arguments.

If you don't like this, feel free to point out any problems or just cherrypick the new unit tests (it's a separate commit) and fix them differently.

AI disclaimer: the unit tests were written with AI assistance (and I at least read all of it)

exyi added 2 commits January 24, 2026 23:32
* new ParentFlags is created, similarly to TryEmitMethodCall
  - this avoids unwanted propagation of IgnoreResult, MemberAccess, ...
* handle ParentFlags.InstanceAccess
  - emit load address instruction
* set closure.LastEmitIsAddress (this should be reset to avoid leaking
  this value from the emit of last argument)
* handle IgnoresResult
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