Fix internal error FS0073 w/nested inline SRTP and multiple overloads#19710
Open
gusty wants to merge 1 commit intodotnet:mainfrom
Open
Fix internal error FS0073 w/nested inline SRTP and multiple overloads#19710gusty wants to merge 1 commit intodotnet:mainfrom
gusty wants to merge 1 commit intodotnet:mainfrom
Conversation
Contributor
❗ Release notes required
|
7db563d to
80b121d
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.
Root cause: In
CodegenWitnessExprForTraitConstraint, whenSolveMemberConstraintresolves a trait call,FreshenMethInfocreates fresh type parameters for the method. During overload resolution, the fresh typar for a wildcard_position gets unified with the trait call's anonymous typar, but neither gets solved to a concrete type. The solution'sminstthen carries these unsolved typars throughGenWitnessExpr→BuildFSharpMethodCall→ IlxGen, where they crash because the typar isn't in theTypeReprEnv.Fix: After
SolveMemberConstraintsucceeds, identify any unsolved typars in the solution'sminstthat were freshly introduced during resolution (not present in the original trait constraint's types) and default them usingChooseTyparSolution. This ensures all type arguments in the generated expression are concrete before they reach IL codegen, without affecting typars from the calling context.Fixes #19709
Checklist