-
Notifications
You must be signed in to change notification settings - Fork 832
Open
Labels
Area-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genbugs in SRTP inference, resolution, witness passing, code genBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
Description
It seems that when a member is shadowing an inherited member with a different return type, the return type is not considered to avoid any ambiguity when the compiler is attempting to resolve the member.
Repro steps
Self-explanatory example:
type Mother() =
member this.Hello() =
Unchecked.defaultof<int32>
type Daughter() =
inherit Mother()
member this.Hello() =
Unchecked.defaultof<string>
type SomeoneHolder<'Someone when 'Someone: (member Hello : unit -> string)> =
{ Someone: 'Someone }
let someoneHolder =
{ Someone = Daughter() }Expected behavior
It should compile.
Actual behavior
It does not, with the error below:
[FS0001] A unique overload for method 'Hello' could not be determined based on type information prior to this program point.
A type annotation may be needed. Candidates:member Daughter.Hello : unit -> string,member Mother.Hello : unit -> int32
Known workarounds
None.
Related information
Provide any related information (optional):
The return type
- Operating system: Windows 10 Enterprise
- .NET Runtime kind (.NET Core, .NET Framework, Mono): .NET Core 3.1
- Editing Tools (e.g. Visual Studio Version, Visual Studio): Rider
Lanayx
Metadata
Metadata
Assignees
Labels
Area-Compiler-SRTPbugs in SRTP inference, resolution, witness passing, code genbugs in SRTP inference, resolution, witness passing, code genBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Type
Projects
Status
New