diff options
author | Vitek Karas <10670590+vitek-karas@users.noreply.github.com> | 2022-02-28 14:47:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 14:47:58 +0300 |
commit | f0bd2ae053b96af7a8dae429f9dc91f1ce28684b (patch) | |
tree | 1f9dae3f3fa386e21ca0d33b4ab50ef056d11b94 /test/Mono.Linker.Tests.Cases/DataFlow/DynamicDependencyDataflow.cs | |
parent | 45b481f3504fa3c7142ed22f37d2813b0c7df43f (diff) |
Share intrinsic handling of GetMember and similar APIs (#2639)
Other than sharing more code and adapting it so that it works on both linker and analyzer, this change brings simple analysis of constant integer values in the analyzer. This is necessary to make most reflection API calls recognize binding flags. For example `GetMethods(BindingFlags.Public | BindingFlags.Static)`. So this change adds analysis of constant values (as recognized by the Roslyn's operation tree) and the OR binary operator for integers and enums.
Added some new tests for the binding flags handling.
Reenabled some disabled tests for analyzer.
Moved the main affected tests from the generated source files to the hardcoded one and force them to exact match of warnings for both linker and analyzer.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow/DynamicDependencyDataflow.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/DynamicDependencyDataflow.cs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/DynamicDependencyDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/DynamicDependencyDataflow.cs index 8237bc4db..029e5848b 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/DynamicDependencyDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/DynamicDependencyDataflow.cs @@ -18,18 +18,16 @@ namespace Mono.Linker.Tests.Cases.DataFlow [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] static Type TypeWithPublicMethods; - // Intrinsic is disabled https://github.com/dotnet/linker/issues/2559 [Kept] - [ExpectedWarning ("IL2080", nameof (Type.GetField), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2080", nameof (Type.GetField))] [DynamicDependency ("DynamicDependencyTo")] static void DynamicDependencyFrom () { _ = TypeWithPublicMethods.GetField ("f"); } - // Intrinsic is disabled https://github.com/dotnet/linker/issues/2559 [Kept] - [ExpectedWarning ("IL2080", nameof (Type.GetProperty), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2080", nameof (Type.GetProperty))] static void DynamicDependencyTo () { _ = TypeWithPublicMethods.GetProperty ("p"); |