-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Create separate attribute for warning behavior differences #101220
Create separate attribute for warning behavior differences #101220
Conversation
Rename attributes and update ilc ResultChecker
Just suggestions:
Basically, the two attributes would act as notations which behavior is correct (which is currently missing), but would allow for exceptions per-tool, with attached justification). You could also modify the attributes to not rely on properties but on .ctors instead to enforce the class ExpectedWarning
{
public ExpectedWarning(string warningCode);
public ExpectedWarning(string warningCode, Tool notProducedBy, string reason);
} |
My concern with that is that if it's an argument, it's not immediately clear that it's now NotProducedBy, and since we've used it as ProducedBy previously it might cause confusion. Also, in ExpectedWarning, NotProducedBy makes sense, but ProducedBy makes more sense for UnexpectedWarning, and it might be confusing to have it mean different things.
This was my initial plan, but the test validators look for the Another thing to consider is the This is what I'm planning to update the PR to: class ExpectedWarningAttribute : Attribute
{
public ExpectedWarningAttribute(string warningCode, params string[] messageContains) {}
public ExpectedWarningAttribute(string warningCode, string messageContains, Tool producedBy, string issueLinkOrReason) {}
public ExpectedWarningAttribute(string warningCode, string[] messageContains, Tool producedBy, string issueLinkOrReason) {}
}
class UnexpectedWarningAttribute : Attribute
{
public UnexpectedWarningAttribute(string warningCode, string messageContains, Tool producedBy, string issueLinkOrReason) {}
public UnexpectedWarningAttribute(string warningCode, string[] messageContains, Tool producedBy, string issueLinkOrReason) {}
} |
… to find ProducedBy
...ls/illink/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnexpectedWarningAttribute.cs
Outdated
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/ResultChecker.cs
Show resolved
Hide resolved
src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/TestChecker.cs
Outdated
Show resolved
Hide resolved
…1220) To help track differences in the warning behavior of the trimming related tools, this modifies how adds UnexpectedWarning, and requires an issue link to be provided when there is a ProducedBy argument to the constructor. To enforce that either both a ProducedBy and IssueLink is provided or neither, the ProducedBy property is removed and is provided as the second to last argument, and IssueLink is provided as the last argument. ExpectedWarning means that the correct behavior is to warn. Any attributes that expect it only from a subset of the tools must provide an issue link. (These are mostly blank strings now, though) UnexpectedWarning means that this warning is not the correct behavior. These attributes always include a ProducedBy anrdshould link to an issue. Changes Look for a Tool attribute argument in the second to last position of ExpectedWarning and Unexpected warning when a ProducedBy property is not found. Find a replace existing ExpectedWarnings to use the new constructors. Adds issue links within AttributedMembersAccessedViaReflection.cs and in some places in ArrayDataFlow.cs
…1220) To help track differences in the warning behavior of the trimming related tools, this modifies how adds UnexpectedWarning, and requires an issue link to be provided when there is a ProducedBy argument to the constructor. To enforce that either both a ProducedBy and IssueLink is provided or neither, the ProducedBy property is removed and is provided as the second to last argument, and IssueLink is provided as the last argument. ExpectedWarning means that the correct behavior is to warn. Any attributes that expect it only from a subset of the tools must provide an issue link. (These are mostly blank strings now, though) UnexpectedWarning means that this warning is not the correct behavior. These attributes always include a ProducedBy anrdshould link to an issue. Changes Look for a Tool attribute argument in the second to last position of ExpectedWarning and Unexpected warning when a ProducedBy property is not found. Find a replace existing ExpectedWarnings to use the new constructors. Adds issue links within AttributedMembersAccessedViaReflection.cs and in some places in ArrayDataFlow.cs
To help track differences in the warning behavior of the trimming related tools, this modifies how adds
UnexpectedWarning
, and requires an issue link to be provided when there is aProducedBy
argument to the constructor. To enforce that either both aProducedBy
andIssueLink
is provided or neither, theProducedBy
property is removed and is provided as the second to last argument, andIssueLink
is provided as the last argument.ExpectedWarning
means that the correct behavior is to warn. Any attributes that expect it only from a subset of the tools must provide an issue link. (These are mostly blank strings now, though)UnexpectedWarning
means that this warning is not the correct behavior. These attributes always include aProducedBy
anrdshould link to an issue.Changes
Tool
attribute argument in the second to last position of ExpectedWarning and Unexpected warning when aProducedBy
property is not found.ExpectedWarning
s to use the new constructors.Follow up