Conversation
Change InferType() to an abstract method and implement for every ILInstruction. With this change, we now always have enough information to create a variable of an appropriate type to store the result of evaluating the instruction. This previously was not the case for instructions producing "other value type", for which the stacktype-based fallback incorrectly produced `object`.
Previously this happened within the InferType implementation.
…ed to agree in the type.
…of the call was ignored.
…IsAssignment GetPointerElementType existed because a pointer passing through a stack slot could be typed IntPtr: ILReader replaced the slot type with FindType(StackType) whenever the inferred type did not match the stack type. With InferType() implemented on every ILInstruction that fallback is gone (FlushExpressionStack now asserts the inferred type is stack-accurate), so the target's inferred type is precise and the definition chain no longer needs to be walked. Merged stack slots were never recovered by the helper anyway (it required a single store). Disabling the PointerType arm makes the uint*/byte* deconstruction fixtures fail, so the sign-agnostic stobj.Type fallback remains guarded. Assisted-by: Claude:claude-fable-5:Claude Code
dgrunwald
force-pushed
the
infer-type
branch
from
September 2, 2026 20:57
57d755d to
9aa3911
Compare
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.
Change InferType() to an abstract method and implement for every ILInstruction.
With this change, we now always have enough information to create a variable of an appropriate type to store the result of evaluating the instruction.
This previously was not the case for instructions producing "other value type", for which the stacktype-based fallback incorrectly produced
object.