-
Notifications
You must be signed in to change notification settings - Fork 804
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
Regression in overload resolution #18288
Comments
The current depth limit is 300 calls within type inference (ConstraintSolver), I will check how it behaved before net9 and how much more would be needed to make this code compile in net9. There have been changes in the code for ConstraintSolver which can in turn lead to more recursive invocations of type solving. |
I found out there was an infinite loop in type inference (= limit increase would not help) when the following was encountered: Is there a reason for this annotation I am not seeing? Or is this somewhat intentional when writing SRTP members like this, to define a member which can be never satisfied by any type? |
@T-Gro thanks for having a look at this
Yes, in many cases we need to generate ambiguity in order to avoid overload resolution to resolve earlier. For those cases we have what I call "the impossible overload", which generates the ambiguity needed and at the same time provides no danger of resolving to it.
I suspected about an infinite loop, but of course, this worked since F# 2.0 |
I do have code prepared which both fixes the recursion but also gives a new error for the I wonder if there is another solution that would support the SRTP use cases and yet error in regular code to prevent invalid combinations. (In the worst case, if no other solution is found to add this ambiguity, I can comment out the added consistency check for now...) |
Yes, if you introduce an error at this stage (v9 of the compiler) it would break lot of existing code. |
As for other inconsistency checks for type parameters goes, this one would inconsistent in being a warning and not an error. I will make the change. |
After updating to F#9 I'm observing many regressions in overload resolution.
Here I managed to capture one of them, this one keeps failing even using the langversion flag.
Repro steps
Try this in fsi
Expected behavior
Actual behavior
Known workarounds
Make the last two lines a single one:
let v = Choice.Invoke (WrappedSeqE [Ok 1; Error "a" ])
Related information
Provide any related information (optional):
Microsoft (R) F# Interactive version 12.9.101.0 for F# 9.0
* Operating systemThe text was updated successfully, but these errors were encountered: