Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix :: Fix 'Type inference problem too complicated' for SRTP with "T:null and T:struct" dummy constraint #18345

Merged
merged 5 commits into from
Mar 11, 2025

Conversation

T-Gro
Copy link
Member

@T-Gro T-Gro commented Feb 27, 2025

Fixes #18288.

The problem occured when inferring types and the solution contained a method defined like _: 'T when 'T: null and 'T: struct.
This problem is fixed.

I have also added consistency checks for pairs of typar constraints that are invalid - will wait in the issue comments for @gusty to see if reporting an error for this combination will break an essential trick without providing alternative.

I also realized that combination of delegate and comparison constraints is invalid as well, but was misusing a wrong error message -> it gets a new error message now.

With all the logic around typarTy and checks for their constraints having the following form:

            isTyparTy g ty
            && (destTyparTy g ty).Constraints
               |> List.exists (function
                   | TyparConstraint...._ -> true
                   | _ -> false)

,the code got convoluted with this boilerplate.
I extracted this logic into helper functions and applied them where they made sense:

ty |> IsTyparTyWithConstraint g _.Is....

…ks, simplify TyparConstraint retrieval logic in the codebase
@T-Gro T-Gro requested a review from a team as a code owner February 27, 2025 20:02
@T-Gro T-Gro linked an issue Feb 27, 2025 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Feb 27, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.300.md

@T-Gro T-Gro enabled auto-merge (squash) March 10, 2025 15:36
@T-Gro T-Gro merged commit 88f8041 into main Mar 11, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Regression in overload resolution
4 participants