Calling a generic method during object construction incorrectly constrains the generic to a type
Open
Area-Compiler-Checking
Bug
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
When calling a generic method directly during object construction I get a warning that my code is causing my method to be less generic than the type annotation.
**Repro steps**
``` fsharp
type Test() as self =
do
self.PrintString 12
member this.PrintString<'a> (x : 'a) = Console.WriteLine(x.ToString())
```
**Expected behavior**
The above compiles without warnings.
**Actual behavior**
I get the warning `FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'int'`
**Related information**
.NET 9.0
Contributor guide
Assessment
This issue has not been assessed yet.