Uh oh!
There was an error while loading. Please reload this page.
Disallow calling abstract methods directly on interfaces - #16319
Disallow calling abstract methods directly on interfaces#16319edgarfgp wants to merge 22 commits into
Conversation
…hub.com:edgarfgp/fsharp into disallow-calling-methods-directly-on-interfaces
| |> shouldFail | ||
| |> withDiagnostics [ | ||
| (Error 3861, Line 13, Col 71, Line 13, Col 79, "Interfaces cannot access static abstract members directly.") | ||
| ] |
There was a problem hiding this comment.
That's not right, constrained calls 'T.Parse should work through multiple levels of inheritance, since it will know specific implementation at runtime. ISpanParsable<'T>.Parse, if it's non-virtual, shouldn't on other hand.
Uh oh!
There was an error while loading. Please reload this page.
vzarytovskii
commented
Nov 25, 2023
Thanks for changing it @edgarfgp, do you think it makes sense to just filter those out as non-valid methods or is it just me? It's a quite unique and new situation, since we don't really have it for non-statics. |
Also, a reminder for myself for Monday: test that we still have autocomplete on type constrained call, e.g. |
edgarfgp
commented
Nov 25, 2023
I think the static nature of this methods will raise the expectation of been available through competition in a type tbh and it that case a dedicated error message explaining the reasoning of this behaviour will be desirable. That being said in this PR my main focus is to prevent the runtime errors currently happening. |
edgarfgp
commented
Nov 25, 2023
Could you also check the filtering condition please. I haven’t found yet a way to make this test pass. |
vzarytovskii
commented
Nov 25, 2023
Do we really want for it to be available via completion, it it will lead to the compile time error? I.e. not usable if it's non-virtual? |
❗ Release notes required
|
edgarfgp
commented
Apr 10, 2024
Replaced by #17021 |
Fixes#14012
See:
https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Numerics/IAdditionOperators.cs,5b77e6b404819054