op_Implicit
not resolved when having a generic type called via a static member
#17039
MangelMaxime
started this conversation in
General
Replies: 1 comment 2 replies
-
Hmm, I've definitely seen overload resolution ambiguities arise before when there are overloads with generic types, even when a type argument is supplied, e.g., #14318, and even when the method being overloaded is not ...But these all work fine: // These all work.
ErasedType.op_Implicit 2
ErasedType.op_Implicit variable
ErasedType.op_Implicit {| x = 2 |}
ErasedType.op_Implicit { x = 2 }
ErasedType.op_Implicit [ "a"; "b"; "c" ]
ErasedType.op_Implicit (ResizeArray ["a"; "b"; "c"])
ResizeArray ["a"; "b"; "c"] |> ErasedType.op_Implicit
ErasedType.op_Implicit (ResizeArray ["a"; "b"; "c"]) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am working with
op_Implicit
in order to make a Fable binding. Doing so allows for a nice syntax while still being able to represents the crazy API coming from JavaScript (which we all love 😅).However, there are situation where it seems like the
op_Implicit
is not resolved and requires the creation of an intermediate variable.Something that I find strange also the following:
In my mind they are equivalent so my supposition is F# compiler type inference is not resolved the same way in this situation?
Even if we try to help the type system as much as possible, by fully qualifying the
ResizeArray
it does not seems to be enought:My goal with this discussion is to check if this is expected or if this is something that could perhaps be improved?
Edit:
We discovered that using
seq { .. }
instead of the list builder works:Beta Was this translation helpful? Give feedback.
All reactions