Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateo Torres-Ruiz <mateoatr@users.noreply.github.com>2021-09-17 00:42:34 +0300
committerGitHub <noreply@github.com>2021-09-17 00:42:34 +0300
commit6f237bb253a4e86479b0bf6949ec68e5793505f1 (patch)
tree2e778bc0f1da8ad850bc48ed71c397b43377dd2e /test/Mono.Linker.Tests.Cases.Expectations/Assertions
parent7c88b9ba691d65014934637acfec27f1a985cea9 (diff)
Warn on RUC annotated attribute ctors (analyzer) (#2201)
* Warn on usage of attributes with annotated ctors * PR feedback Add ProducedBy from Test Restructure Add support for SetupCompileBefore in the analyzer Run analyzer tests on all members (not only methods) Move tests to RequiresCapability * Enable analyzer tests for attributes which use RUC annotated properties * Lint * Rename CheckAttributeCtor Check for instantiations that set annotated properties * Apply suggestions from code review Co-authored-by: Andy Gocke <angocke@microsoft.com> * Update comment Rename Linker => Trimmer in ProducedBy * Fix applied suggestions * Lint Co-authored-by: Andy Gocke <angocke@microsoft.com>
Diffstat (limited to 'test/Mono.Linker.Tests.Cases.Expectations/Assertions')
-rw-r--r--test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedWarningAttribute.cs7
-rw-r--r--test/Mono.Linker.Tests.Cases.Expectations/Assertions/ProducedBy.cs16
2 files changed, 21 insertions, 2 deletions
diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedWarningAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedWarningAttribute.cs
index 5f2fc633e..02376d513 100644
--- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedWarningAttribute.cs
+++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ExpectedWarningAttribute.cs
@@ -16,8 +16,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public int SourceLine { get; set; }
public int SourceColumn { get; set; }
- // Set to true if the warning only applies to global analysis (ILLinker, as opposed to Roslyn Analyzer)
- public bool GlobalAnalysisOnly { get; set; }
+ /// <summary>
+ /// Property used by the result checkers of trimmer and analyzers to determine whether
+ /// the tool should have produced the specified warning on the annotated member.
+ /// </summary>
+ public ProducedBy ProducedBy { get; set; } = ProducedBy.TrimmerAndAnalyzer;
public bool CompilerGeneratedCode { get; set; }
}
diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ProducedBy.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ProducedBy.cs
new file mode 100644
index 000000000..1277f897b
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/ProducedBy.cs
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+
+namespace Mono.Linker.Tests.Cases.Expectations.Assertions
+{
+ [Flags]
+ public enum ProducedBy
+ {
+ Trimmer = 1,
+ Analyzer = 2,
+ TrimmerAndAnalyzer = Trimmer | Analyzer
+ }
+} \ No newline at end of file