Handle unresolved value-type call targets - #4053
Open
sonyps5201314 wants to merge 1 commit into
Open
Conversation
A missing value-type definition makes ILReader insert a Ref-to-Unknown conversion before instance calls. Preserve the managed-reference receiver so C# output does not fall back to invalid ref casts or unsafe pointers. Assisted-by: Codex:gpt-5.6-sol:Codex
1 task
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.
Related to #4049.
Problem
When an instance method belongs to a value type from a missing assembly, its declaring type has unknown stack semantics. ILReader inserts an invalid
Ref -> Unknownconversion around the managed-reference receiver.ExpressionBuilder.TranslateTargetthen treats the conversion as a value receiver and emits invalid C# such as:Solution
For the narrowly defined
Invalid,Ref -> Unknownconversion on an unresolved call target:UnwrapConvhelper to recover the original managed-reference receiver;This PR contains only this call-target fix and its
Issue3729regression case. It does not include constructor-initializer, primary-constructor, collection-expression, resolver, project export, or backing-field changes from #4049.Test
The ILPretty case was added first. Before the implementation it failed with an
unsafemethod, a(MyEnumerator)(ref value)cast, and a pointer dereference for the constrainedIDisposable.Disposecall.After the implementation:
ILPrettyTestRunner.Issue3729: passed.ILPrettyTestRunnerfixture: 63 total, 62 passed, 1 pre-existing ignored, 0 failed.Release|Any CPUsolution build: 16 succeeded, 0 failed.BuildTools/format.ps1: clean.