When struct val field name equals constructor argument "ambiguous overload"
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
When struct val field name equals constructor argument "ambiguous overload"
```fs
open System
[]
type C =
val private x: int
new (x) = { x = x }
//error FS0041: A unique overload for method 'C' could not be determined based on type information
// prior to this program point. A type annotation may be needed. Candidates: C (), new : x:int -> C
let test = C(x = 0)
```
https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AbEAzAzgHwgAcYA7AAgGUBPXAFxgFsBYAKDbYG0AeSuqAK5g6APgC6bOtRLkAwuQC8bcivIA3AIYZyRKAEtNDcghDk9pOstWkYAd3IAKBAEpF5AN7G3CcgF8rKmwYMHTkDPRusk5uAAzOQA===
Changing `new (x)` to say `new (y)` (and its references) allows the resolution to succeed. ¯\\_(ツ)_/¯
Contributor guide
Assessment
This issue has not been assessed yet.