Skip to content

Conversation

@Smaug123
Copy link
Contributor

@Smaug123 Smaug123 commented Dec 2, 2025

Description

Cope with conditional constraints in witness passing. See extensive inline comments for the reasoning.

The initial three commits were created by Claude Opus 4.5. I then reviewed it, in the process adding some fairly extensive docstrings (all docstrings and comments in this PR come from me, except the big one in the test file). My understanding of the witness generation code is still fairly limited, and I was relying on Opus to point me to the right places to understand it; I believe my mental model is coherent, but I'm still not completely sure that it's accurate.

If you would like to simply close this without review on grounds of LLM generation by a non-domain-expert then go for it, although I don't think I could do any better with my human brain.

Fixes #19118

For reference, additional context I gave Claude as well as the text of #19118 Here is the stack trace at the point where we set the "supports comparison" constraint on the type, which we eventually try to find a witness for (and apparently fail), if that helps; but I don't know where the bug actually comes from.

🔴 TypedTree.Typar.SetConstraints() in FSharp.Compiler, FSharp.Compiler.Service.dll
[email protected]() in FSharp.Compiler, FSharp.Compiler.Service.dll
◻ ListModule.loop@248-3<FSharp.Compiler.TypedTree.Typar, FSharp.Compiler.TypedTree.Typar>() in Microsoft.FShar...
◻ ListModule.Iterate2<FSharp.Compiler.TypedTree.Typar, FSharp.Compiler.TypedTree.Typar>() in Microsoft.FShar...
◻ TypeHierarchy.FixupNewTypars() in FSharp.Compiler, FSharp.Compiler.Service.dll
◻ ConstraintSolver.FreshenAndFixupTypars() in FSharp.Compiler, FSharp.Compiler.Service.dll
◻ ConstraintSolver.FreshenTypeInst() in FSharp.Compiler, FSharp.Compiler.Service.dll
◻ ConstraintSolver.CodegenWitnessesForTyparInst() in FSharp.Compiler, FSharp.Compiler.Service.dll
🔴 FSharpExprConvert.GetWitnessArgs() in FSharp.Compiler.Symbols, FSharp.Compiler.Service.dll
◻ FSharpExprConvert.ConvModuleValueOrMemberUseLinear() in FSharp.Compiler.Symbols, FSharp.Compiler.Service.dll
[email protected]() in FSharp.Compiler.Symbols, FSharp.Compiler.Service.dll
◻ FSharpExpr.get_E() in FSharp.Compiler.Symbols, FSharp.Compiler.Service.dll
◻ FSharpExpr.get_ImmediateSubExpressions() in FSharp.Compiler.Symbols, FSharp.Compiler.Service.dll
[email protected]() in CompilerDirectives, FSharp.Compiler.ComponentTests.dll [2]
[email protected]() in CompilerDirectives, FSharp.Compiler.ComponentTests.dll [1]
◻ Line.demo of [email protected]() in CompilerDirectives, FSharp.Compiler.ComponentTests.dll

Checklist

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated:
    I believe release notes aren't necessary for this change, since it's purely a bugfix. I don't seem to be able to add labels, though?

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@Smaug123 Smaug123 changed the title Witnesses Don't find witnesses for typars with conditional constraints Dec 2, 2025
@Smaug123
Copy link
Contributor Author

Smaug123 commented Dec 2, 2025

I think this change doesn't need release notes; it's a pure bugfix.

@Smaug123 Smaug123 marked this pull request as ready for review December 2, 2025 08:47
@Smaug123 Smaug123 requested a review from a team as a code owner December 2, 2025 08:47
@github-project-automation github-project-automation bot moved this from New to In Progress in F# Compiler and Tooling Dec 4, 2025
@T-Gro T-Gro enabled auto-merge (squash) December 4, 2025 08:23
@Smaug123
Copy link
Contributor Author

Smaug123 commented Dec 4, 2025

@T-Gro Thanks! I may just be incompetent with GitHub, but I can't find how to add the label that gets the release notes check to pass?

@edgarfgp edgarfgp added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Dec 4, 2025
@T-Gro T-Gro merged commit 89d7886 into dotnet:main Dec 5, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

FCS crash with ConstraintSolverMissingConstraint on valid F# file

3 participants