Description
Some code does not compile anymore, but used to compile just fine. See repro:
Repro steps
Given this code from this original post on StackOverflow, which shows a possible way to emulate semi-polyvariadic functions in F#:
type T = T with
static member inline ($) (T, r:'t->'t ) = fun a b -> a + b
static member inline ($) (T, r:'t->'t->'t ) = fun a b c -> a + b + c
static member inline ($) (T, r:'t->'t->'t->'t) = fun a b c d -> a + b + c + d
let inline sum (x:'a) :'r = (T $ Unchecked.defaultof<'r>) x
// following lines cause error FS0003: This value is not a function and cannot be applied.
let x:int = sum 2 3
let y:int = sum 2 3 4
let z:int = sum 2 3 4 5
let d:decimal = sum 2M 3M 4M
Expected behavior
Code that was valid and used to compile should remain compilable in future versions of F# (barring changes to the library that may shadow functions, or known backwards incompatibilities).
Actual behavior
It doesnt' compile anymore. It compiles fine in VS2015 with F# (just paste in REPL), but not in VS2017. I don't know exactly from what version of VS it stopped working.
Known workarounds
No idea, in the mentioned post another approach to polyvariadic functions is given that compiles fine (and compiled fine, but didn't run in debug builds, but this was fixed, see #865), which could be used in an alternative, but is more limited in terms of argument types.
Related information
Seen working in VS2015, stopped working in VS2017. Tested up until VS 2017 15.8 Preview 2, only tested on Windows versions of VS.
I don't see anything terribly "on the edge" in the code above, unless I am missing it, but essentially these are just overrides and I think this code is sound and should compile just fine.
I am not aware of an incompatibility that was introduced in the VS 2017 F# compiler that was "by design", but please close this with due comment if I've missed it ;).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status