dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.83k stars 773 forks source link

Warning missing for members hiding members in special inheritance cases #5803

Open realvictorprm opened 5 years ago

realvictorprm commented 5 years ago

The compiler isn't warning about that the member Foo of DerivedDerived is hiding the member Foo of Derived. It's only warning that Foo of Derived is hiding Foo of Base.

type Base() =
    abstract member Foo : unit -> unit
    default this.Foo() = printfn "Base"

type Derived() =
    inherit Base()
    member this.Foo() = printfn "Derived"

type DerivedDerived() =
    inherit Derived()
    member this.Foo() = printfn "DerivedDerived"

Expected behavior

Compiler warns that DerivedDerived is hiding a member of Derived.

Actual behavior

No warning.

Known workarounds

None

Related Information

F# 4.5

dsyme commented 5 years ago

The F# language specification doesn't say anything either way about this, but yes it would make sense to warn like C# does

realvictorprm commented 5 years ago

The warning can easily be improved without effecting inference. Should I open a PR with my proposal?

dsyme commented 5 years ago

The warning can easily be improved without effecting inference. Should I open a PR with my proposal?

Yes sure

realvictorprm commented 5 years ago

Thank you. Will do this 😃