No-sense results coming from overload call
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Please provide a succinct description of the issue.
**Repro steps**
```
type U = U with
static member inline ($) (U , (_, _, rest) ) = printfn "tuple3"; rest
static member inline ($) (U , x : 'T when 'T : null) = printfn "null" ; x
static member inline ($) (_:obj, t ) = printfn "end" ; t
static member inline ($) (U , (_, rest) ) = printfn "tuple2"; U $ rest
U $ (1, (2,3))
```
**Actual behavior**
```
tuple2
end
val it : int = 785299152 (or another crazy number, it changes with each run)
```
**Expected behavior**
A compiler error or an overload being picked, resulting in a deterministic value.
If the overload resolution is as the above printings reveals, the result value should be:
`val it : int*int = (2,3)`
**Known workarounds**
None
**Related information**
I' m using VS 2019.
I managed to try it with VS 2015 and got the following compile error before VS close due to end of my trial period:
```
static member inline ($) (_:obj, t ) = printfn "end" ; t
static member inline ($) (U , (_, rest) ) = printfn "tuple2"; U $ rest
;;
static member inline ($) (U , (_, rest) ) = printfn "tuple2"; U $ rest
-----------------------------------------------------------------------------------^^
stdin(6,84): error FS0001: This expression was expected to have type
'_arg9
but here has type
'b
```
I think this issue has to be investigated as it may reveal that a change (since VS 2015) introduced a bug that bypass compile checks and result in weird run-time conversions.
It seems to me that it is returning the reference to the tuple, converted to an int.
Contributor guide
Assessment
This issue has not been assessed yet.