-
Notifications
You must be signed in to change notification settings - Fork 38
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
Weird value returned after (maybe failed) overload resolution #155
Comments
Hi @gusty! Thanks a lot for the report and providing the code to reproduce. This is interesting, when debugging the sample I can see the F# compiler does provide witnesses for resolution so Fable's own mechanism doesn't come into play here. It could be an issue with Fable when assigning the witness, but right now it looks as if FCS resolves the witness differently for .NET compilation and when creating the AST 😕 If you change the first argument in the second static member inline Delay (_mthd: Default3, x: unit-> ^``Monad<'T>`` when ^``Monad<'T>`` : struct , _: Default2) = Bind.Invoke (Return.Invoke ()) x : ^``Monad<'T>``
static member inline Delay (_mthd: Default3, x: unit-> ^``Monad<'T>`` when ^``Monad<'T>`` : not struct , _: Default1) = Bind.Invoke (Return.Invoke ()) x : ^``Monad<'T>`` |
Thanks for the workaround and interesting trace into the overload resolution problem, however the goal of this repro was to understand why Fable returns this object value. |
Ah, sorry, didn't read well the description. The returned object is the lazy value, it looks like indeed is picking the wrong overload. The problem here is we haven't implemented ToString for lazy objects so you just see the default stringification for JS objects. We should fix that. |
This bug is not about taking the wrong overload, which is an ongoing problem not easy to solve, but about returning a value not corresponding to any of the overloads.
I'm under the impression that overload resolution fails and then some buggy code returns a no sense value instead of a compile error.
Here's a repro
Running this prints
res is [object Object]
, but if we comment out the first overload of Delay, we getres is [5]
which is the expected result.Not sure, but it seems to be a problem when there are constraints in the overload, like
not struct
.The text was updated successfully, but these errors were encountered: