-
Notifications
You must be signed in to change notification settings - Fork 548
[RGen] Add validations for Category methods. #23791
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -540,11 +540,63 @@ | |
<value>No result type or result type name was provided for an async method.</value> | ||
</data> | ||
<data name="RBI0040MessageFormat" xml:space="preserve"> | ||
<value>The method '{0}' was marked as async and has multiple parameters but does not provide a return type name, a nameless tuple will be generated for the async method</value> | ||
<value>The method '{0}' was marked as async and has multiple parameters but does not provide a return type name, a nameless tuple will be generated for the async method</value> | ||
<comment>{0} is the name of the async method.</comment> | ||
</data> | ||
<data name="RBI0040Title" xml:space="preserve"> | ||
<value>Not specified return type</value> | ||
</data> | ||
|
||
<!-- RBI0041 --> | ||
|
||
<data name="RBI0041Description" xml:space="preserve"> | ||
<value>UIView subclasses must have a initWithFrame: constructor..</value> | ||
</data> | ||
<data name="RBI0041MessageFormat" xml:space="preserve"> | ||
<value>The class '{0}' inherits from UIView but does not expose a 'initWithFrame:' constructor</value> | ||
<comment>{0} is the name of the class.</comment> | ||
</data> | ||
<data name="RBI0041Title" xml:space="preserve"> | ||
<value>Missing UIView initWithFrame:</value> | ||
</data> | ||
|
||
<!-- RBI0042 --> | ||
|
||
<data name="RBI0042Description" xml:space="preserve"> | ||
<value>Category methods have to be partial.</value> | ||
</data> | ||
<data name="RBI0042MessageFormat" xml:space="preserve"> | ||
<value>The method '{0}' must me partial</value> | ||
<comment>{0} is the name of the method.</comment> | ||
</data> | ||
<data name="RBI0042Title" xml:space="preserve"> | ||
<value>Not partial category method</value> | ||
</data> | ||
|
||
<!-- RBI0043 --> | ||
|
||
<data name="RBI0043Description" xml:space="preserve"> | ||
<value>All category methods have to be extensions.</value> | ||
</data> | ||
<data name="RBI0043MessageFormat" xml:space="preserve"> | ||
<value>The method '{0}' in category '{1}' has to be an extension method for '{2}'</value> | ||
<comment>{0} is the name of the class.</comment> | ||
</data> | ||
<data name="RBI0043Title" xml:space="preserve"> | ||
<value>All methods in an category have to be extensions</value> | ||
</data> | ||
|
||
<!-- RBI0044 --> | ||
|
||
<data name="RBI0044Description" xml:space="preserve"> | ||
<value>Extension methods have to be of the same type as of the category.</value> | ||
</data> | ||
<data name="RBI0044MessageFormat" xml:space="preserve"> | ||
<value>Extension method '{0}' in category '{1}' must have the first parameter type match the category's extended type '{2}' found '{3}'</value> | ||
<comment>{0} is the name of the method, {1} the name of the categoyr, {2} is the category type and {3} is the type found</comment> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two typos in resource strings: 'must me partial' should be 'must be partial' and 'categoyr' should be 'category'. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
</data> | ||
<data name="RBI0044Title" xml:space="preserve"> | ||
<value>Wrong 'this' parameter in category method</value> | ||
</data> | ||
|
||
</root> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -616,4 +616,64 @@ public static class RgenDiagnostics { | |
description: new LocalizableResourceString (nameof (Resources.RBI0040Description), Resources.ResourceManager, | ||
typeof (Resources)) | ||
); | ||
|
||
/// <summary> | ||
/// Disgnostic descriptor for when a class inherits from UIView and is missing the initWithFrame: constructor. | ||
/// </summary> | ||
internal static readonly DiagnosticDescriptor RBI0041 = new ( | ||
"RBI0041", | ||
new LocalizableResourceString (nameof (Resources.RBI0041Title), Resources.ResourceManager, typeof (Resources)), | ||
new LocalizableResourceString (nameof (Resources.RBI0041MessageFormat), Resources.ResourceManager, | ||
typeof (Resources)), | ||
"Usage", | ||
DiagnosticSeverity.Error, | ||
isEnabledByDefault: true, | ||
description: new LocalizableResourceString (nameof (Resources.RBI0041Description), Resources.ResourceManager, | ||
typeof (Resources)) | ||
); | ||
|
||
/// <summary> | ||
/// Disgnostic descriptor for when a category method is not partial | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo in XML documentation comments: 'Disgnostic' should be 'Diagnostic' in all three instances. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
/// </summary> | ||
internal static readonly DiagnosticDescriptor RBI0042 = new ( | ||
"RBI0042", | ||
new LocalizableResourceString (nameof (Resources.RBI0042Title), Resources.ResourceManager, typeof (Resources)), | ||
new LocalizableResourceString (nameof (Resources.RBI0042MessageFormat), Resources.ResourceManager, | ||
typeof (Resources)), | ||
"Usage", | ||
DiagnosticSeverity.Error, | ||
isEnabledByDefault: true, | ||
description: new LocalizableResourceString (nameof (Resources.RBI0042Description), Resources.ResourceManager, | ||
typeof (Resources)) | ||
); | ||
|
||
/// <summary> | ||
/// Disgnostic descriptor for when a category method is not and extension | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo in XML documentation comments: 'Disgnostic' should be 'Diagnostic' in all three instances. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
/// </summary> | ||
internal static readonly DiagnosticDescriptor RBI0043 = new ( | ||
"RBI0043", | ||
new LocalizableResourceString (nameof (Resources.RBI0043Title), Resources.ResourceManager, typeof (Resources)), | ||
new LocalizableResourceString (nameof (Resources.RBI0043MessageFormat), Resources.ResourceManager, | ||
typeof (Resources)), | ||
"Usage", | ||
DiagnosticSeverity.Error, | ||
isEnabledByDefault: true, | ||
description: new LocalizableResourceString (nameof (Resources.RBI0043Description), Resources.ResourceManager, | ||
typeof (Resources)) | ||
); | ||
|
||
/// <summary> | ||
/// Disgnostic descriptor for when a category method is not and extension of the category's target type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo in XML documentation comments: 'Disgnostic' should be 'Diagnostic' in all three instances. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
/// </summary> | ||
internal static readonly DiagnosticDescriptor RBI0044 = new ( | ||
"RBI0044", | ||
new LocalizableResourceString (nameof (Resources.RBI0044Title), Resources.ResourceManager, typeof (Resources)), | ||
new LocalizableResourceString (nameof (Resources.RBI0044MessageFormat), Resources.ResourceManager, | ||
typeof (Resources)), | ||
"Usage", | ||
DiagnosticSeverity.Error, | ||
isEnabledByDefault: true, | ||
description: new LocalizableResourceString (nameof (Resources.RBI0044Description), Resources.ResourceManager, | ||
typeof (Resources)) | ||
); | ||
} |
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.
Two typos in resource strings: 'must me partial' should be 'must be partial' and 'categoyr' should be 'category'.
Copilot uses AI. Check for mistakes.