-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
[.NET] Clean diagnostic rules #88469
[.NET] Clean diagnostic rules #88469
Conversation
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.
modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
Outdated
Show resolved
Hide resolved
modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
Outdated
Show resolved
Hide resolved
context.ReportDiagnostic(Diagnostic.Create( | ||
Common.TypeArgumentParentSymbolUnhandledRule, | ||
typeArgumentSyntax.GetLocation(), | ||
parentSymbol.ToDisplayString() | ||
)); |
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.
I feel like GD0303 shouldn't be a diagnostic, I was originally throwing an exception instead but neikeq was against it because it would stop the analyzer (see #64731 (comment)).
The way I see it diagnostics are problems in user code, but this is an internal error (a bug in the generator) and it should be unreachable anyway because we should handle all the kinds of type argument symbols. So I don't think it should be a diagnostic.
I would love to hear what you think we should do here, but it's not a blocker to merge this PR.
modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
Outdated
Show resolved
Hide resolved
modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
Outdated
Show resolved
Hide resolved
facf876
to
87a5f48
Compare
Applied your comments, and made a few more improvements:
I agree with you for GD0303, but I'm more inclined to retire it in another PR (early in the 4.4 cycle?). |
87a5f48
to
1c798ed
Compare
These are not the same thing though: class MyType<T> {} // T is a type parameter.
new MyType<string>(); // string is a type argument. So you can only add the
Sounds good to me. |
So |
Move the following diagnostics into static readonly fields: GD0101, GD0102, GD0103, GD0104, GD0105, GD0106, GD0107, GD0201, GD0202, GD0203, GD0301, GD0302, GD0303, GD0401, GD0402. To be more consistent, the titles for the following diagnostics were modified: GD0101, GD0105, GD0106, GD0302, GD0303, GD0401, GD0402. A subsequent update of the documentation repo is needed. Tests for the following diagnostics were created: GD0201, GD0202, GD0203.
Yes, I think |
1c798ed
to
5981886
Compare
Should be good then. |
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.
Looks good. Thanks!
Move the following diagnostics into static readonly fields: GD0101, GD0102, GD0103, GD0104, GD0105, GD0106, GD0107, GD0201, GD0202, GD0203, GD0301, GD0302, GD0303, GD0401, GD0402.
To be more consistent, the titles for the following diagnostics were modified: GD0101, GD0105, GD0106, GD0302, GD0303, GD0401, GD0402. A subsequent update of the documentation repo is needed.
Tests for the following diagnostics were created: GD0201, GD0202, GD0203.