SRTP bug in type inference
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
I think it's serious:
```
type Ah =
static member plus (a: Ah, b: Ah) = "Ah"
type TestPlus =
static member plus(a: int, b: int) = a + b
static member plus(a: string, b: string) = a + b
static member plus (a: 'T, b: 'T) = "TestPlus"
let inline plus'< ^t,^x, ^r when (^t or ^x or ^r):(static member plus: ^x * ^x -> ^r)> a b =
((^t or ^x or ^r):(static member plus: ^x * ^x -> ^r) (a, b))
let inline plus a b = plus' a b
let foo2 (a: int) (b: int) = plus a b
```
the code compile to :
```
public static int foo2(int a) (int b)
{
//IL_0006: Expected I4, but got O
return (int)"TestPlus";
}
```
`foo2 1 2`
result is `-464137512`
the type inference should do something here.
Contributor guide
Assessment
This issue has not been assessed yet.