-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix #5531 This is a working fix for the example of #5531. However there are still some points open before I think it's a good idea to merge this: - Discuss the change of this proposal, is it OK to prefer overrides of methods and so ignore base implementations? - Extend the check to the complete inheritance graph instead of a single "look-back" - Only ignore a methinfo if the signature of both match (so respect different overloads) @dsyme It would be great if you could have a look whether this check is allowed at this location or should appear earlier. * Fix left points. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * another approach to fix * remove old approach * Remove approach again and apply different approach. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Adjusting predicate to reflect correct behaviour. * Revert to old List.merge strategy. * Apply review and add tests Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Try fixing weird CI failure Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fix test. Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
- Loading branch information
1 parent
4a9cc93
commit 5a54ebd
Showing
7 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
test.fs(7,17): warning FS0864: This new member hides the abstract member 'abstract member Base.Foo : unit -> unit'. Rename the member or use 'override' instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
test.fs(7,17): warning FS0864: This new member hides the abstract member 'abstract member Base.Foo : unit -> unit'. Rename the member or use 'override' instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Base | ||
Base | ||
Derived | ||
Base | ||
Base | ||
Base | ||
Derived |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Base | ||
Base | ||
Derived | ||
Base | ||
Base | ||
Base | ||
Derived |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type Base() = | ||
abstract member Foo : unit -> unit | ||
default this.Foo() = printfn "Base" | ||
|
||
type Derived() = | ||
inherit Base() | ||
member this.Foo() = printfn "Derived" | ||
|
||
let inline callFoo< ^T when ^T : (member Foo: unit -> unit) > (t: ^T) = | ||
(^T : (member Foo: unit -> unit) (t)) | ||
|
||
let b = Base() | ||
let d = Derived() | ||
let bd = d :> Base | ||
|
||
b.Foo() | ||
bd.Foo() | ||
d.Foo() | ||
|
||
callFoo<Base> b | ||
callFoo<Base> bd | ||
callFoo<Base> d | ||
callFoo<Derived> d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters