Fix UoM ToString codegen with checknulls#19440
Merged
Conversation
The MethInfoWithModifiedReturnType case in BuildMethodCall was recursively calling BuildMethodCall, which re-invoked TakeObjAddrForMethodCall on already-addressed object arguments. This created double-indirection (byref<byref<int>>) for value types, causing ToString() on UoM value types to return garbage when --checknulls+ was enabled. Fix: directly call BuildILMethInfoCall with the already-processed allArgs and valUseFlags, skipping the redundant TakeObjAddrForMethodCall. Added runtime tests verifying ToString on int and float UoM types produces correct output with --checknulls+. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Combine two separate [<Fact>] tests into a single [<Theory>] with [<InlineData>] matching the adjacent test pattern. Add decimal coverage. Simplify embedded source to print x.ToString() directly and verify with withStdOutContains instead of embedded validation logic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use nested pattern MethInfoWithModifiedReturnType(ILMeth(...), retTy) to directly match the only inner method kind that is ever constructed, eliminating the duplicated FSMeth branch that could never be reached. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8f8ec03 to
df4265a
Compare
Contributor
❗ Release notes required
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
df4265a to
5f988ba
Compare
abonie
approved these changes
Mar 16, 2026
This was referenced Mar 16, 2026
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.
Fix double address-taking in BuildMethodCall for UoM value types, which caused ToString() to return garbage when
--checknulls+was enabled.Fixes #19435