-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better ranges for implicit inherit
error reporting.
#17893
Better ranges for implicit inherit
error reporting.
#17893
Conversation
❗ Release notes required
|
Inherit
error reporting.inherit
error reporting.
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
…fgp/fsharp into better-ranges-for-implicit-Inherit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Edgar!
tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs
Outdated
Show resolved
Hide resolved
Please wait for https://github.com/dotnet/fsharp/pull/17905/files to be merged first. |
@edgarfgp Thanks for your contribution! I'm sorry to say this, but I disagree with this change. I'll try to explain it on this example: type T() =
inherit A()
inherit B() I expect that there's an error about multiple |
Could you please also add tests for multiple base interfaces, if there're none? type I =
inherit IA
inherit IB |
@auduchinok No need to apologise for disagreeing. This is a collaborative effort and Im glad that you are reviewing my PRs :) So is the following what you would expect ? [<Fact>]
let ``Types cannot inherit from multiple concrete types.`` () =
Fsx """
type ClassA() = class end
type ClassB() = class end
type ClassC() = class end
type Class() =
inherit ClassA()
inherit ClassB()
inherit ClassC()
"""
|> typecheck
|> shouldFail
|> withDiagnostics [
(Error 959, Line 10, Col 5, Line 10, Col 12, "Type definitions may only have one 'inherit' specification and it must be the first declaration")
(Error 959, Line 11, Col 5, Line 11, Col 12, "Type definitions may only have one 'inherit' specification and it must be the first declaration")
(Error 932, Line 10, Col 13, Line 10, Col 19, "Types cannot inherit from multiple concrete types")
(Error 932, Line 11, Col 13, Line 11, Col 19, "Types cannot inherit from multiple concrete types")
] |
@edgarfgp More or less, yes. I'd probably prefer the |
Humm. But using the type name and not the |
Hm, it should not, since |
@auduchinok Updated following you suggestion. @abonie also suggested the same previously. |
tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs
Outdated
Show resolved
Hide resolved
…fgp/fsharp into better-ranges-for-implicit-Inherit
Head branch was pushed to by a user without write access
@edgarfgp Thanks! |
Description
Better ranges for implicit Inherit error reporting.
Before
After
Checklist