Open gusty opened 4 years ago
I just found a better minimal repro:
type T = T with
static member inline Mtd (f, x: 'FT) = ((^FT or ^FU) : (static member Mtd : _*_ -> _) f, x)
static member inline Mtd (_, _:'t when 't: struct) = ()
let inline invoke x : 'FV =
let inline call (mthd : ^M, i1: ^I1, _output: ^R) = ((^M or ^R) : (static member Mtd : _*_ -> _) (), i1)
call (T, x, Unchecked.defaultof<'FV>)
invoke [|1|]
I've added this to https://github.com/dotnet/fsharp/issues/8690 as any investigation should be in the context of that branch work
By accident I discovered a situation where a dynamic invocation error is thrown at run-time, instead of failing compilation.
Repro steps
Expected behavior
Either to fail compilation, or succeed but without run-time errors. I understand that maybe type inference is not able to solve in some cases like this, but if that's the case, it should fail at compiler-time.
Also, I don't understand why there's a dynamic invocation involved in these static calls.
Actual behavior
Compiles but fails at run-time with
Known workarounds
There are many workarounds, just change a bit the code, for instance invoking the
Bimap
member directly on instances, avoiding theor
constraint.Related information
F# Interactive version 10.7.0.0 for F# 4.7