-
Notifications
You must be signed in to change notification settings - Fork 786
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
let! binding in CE with extension overloads causes FS0072: Lookup on object of indeterminate type #4472
Comments
@cmreen I believe this is by design - adding method overloads (including extension members) can interfere with the applicability of some type inference rules. |
Thanks for the clarification.
|
|
@cmeeren We have historically made improvements to type inference to allow better inference in the presence of overloads, especially in the context of Linq. So improvements are possible though have to be done very carefully. Overloading between The fact that mouse-hover tips knows the answer is because mouse-hover tips use the final, global results of type inference, not the partial results which are used in method overload resolution. There's a separate issue on that though it's been like that a long time. Could you add this as a suggestion at http://github.com/fsharp/fslang-suggestions? We can't do things on a case-by-case basis, but over time can collect a lot of related cases and look at making a technical tweak. |
Mentioned in the type inference umbrella issue (fsharp/fslang-suggestions#594). I'm not sure what the actual root cause is and thus don't really know what I should write in a separate RFC. |
@cmeeren OK, thanks |
I experience an issue similar to #1310 where I get FS0072 after a
let!
binding in a computation expression with overloads.Repro steps
The following AsyncResultBuilder is a stripped-down version of the one in cmeeren/Cvdm.ErrorHandling.
Expected behavior
Everything compiles and works fine.
Actual behavior
I get the following error on
str.Length
:error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
Note that intellisense is able to determine the type:
Known workarounds
Add a type annotation:
The problem also disappears if you remove the extension overload, but this of course has other undesired consequences.
Related information
F# 4.3.4, .NET Standard 2.0 project, VS 15.6.0, latest VF# tools nightly 15.6.0.18030804.
The text was updated successfully, but these errors were encountered: