diff options
author | Sven Boemer <sbomer@gmail.com> | 2021-08-26 03:08:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-26 03:08:22 +0300 |
commit | 5137d45c3adc1f2bab1642170f136e75beafca82 (patch) | |
tree | c21974c51bd8cedf624f5f08e32a568d207a1480 /test/Mono.Linker.Tests.Cases.Expectations | |
parent | 66fd7119cd5744dd8bd37442ac74d2a326085406 (diff) |
Validate unrecognized patterns against logged warnings (#2230)
* Validate unrecognized patterns against logged warnings
This changes the linker validation to check for unrecognized
reflection access patterns against logged messages. The plan is to do
the same for the analyzer tests, allowing us to make progress as we
replace UnrecognizedReflectionAccessPatternAttribute with
ExpectedWarningAttribute.
The UnrecognizedReflectionAccessPatternAttribute is now checked
against both the logged messages and recorded unrecognized reflection
patterns. We check that it matches the same number of patterns as
logged warnings for consistency. This required some changes to the
signature formats used for validation, since the signatures used in
this attribute now need to use the same format as the one we use for
logged warnings.
Changing the signature formats here uncovered some places where we
were still using the cecil signature format even for user-visible
warnings. These have been changed to use the format from
GetDisplayName.
Generic parameter dataflow validation treats the
UnrecognizedReflectionAccessPatternAttribute differently, using the
member name to refer to a generic type parameter. This inconsistency
has been lifted into a separate custom attribute argument that
specifies when the attribute refers to a generic
parameter. Non-generic method parameters had a similar problem, but
this was less common, so those usages were just replaced by
ExpectedWarningAttribute.
* PR feedback
- Continue returning cecil signature as fallback
(replace exception with a debug assert)
- Remove left-over logic from debugging
* Fix more tests
- Use display name signature format for MethodReference
- Revert changes that expect attributes to match only one warning
- Remove debug output
- Also add missing using
Diffstat (limited to 'test/Mono.Linker.Tests.Cases.Expectations')
-rw-r--r-- | test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs index 7d8899712..ac0f9e54c 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs @@ -22,7 +22,8 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions Type[] reflectionMethodParameters, string[] message = null, string messageCode = null, - Type returnType = null) + Type returnType = null, + string genericParameter = null) { } @@ -32,7 +33,8 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions string[] reflectionMethodParameters = null, string[] message = null, string messageCode = null, - Type returnType = null) + Type returnType = null, + string genericParameter = null) { } } |