diff options
author | Sven Boemer <sbomer@gmail.com> | 2022-03-03 02:41:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-03 02:41:50 +0300 |
commit | 75235a5af82689a410eac172e0749f878eef03b8 (patch) | |
tree | 33ef41d8f564f878f55a865a7c7537dd408a2831 | |
parent | a709836737bf8ccc58d9b8c7d5e4bbabc8e28985 (diff) |
Add testcase for intrinsic with override (#2674)
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs index 5ce16ae04..f1cfccc3a 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs @@ -9,16 +9,19 @@ using System.Text; using System.Threading.Tasks; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Helpers; +using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.DataFlow { [SkipKeptItemsValidation] + [SandboxDependency ("Dependencies/TestSystemTypeBase.cs")] [ExpectedNoWarnings] public class TypeBaseTypeDataFlow { public static void Main () { TestAllPropagated (typeof (TestType)); + AllPropagatedWithDerivedClass.Test (); TestPublicConstructorsAreNotPropagated (typeof (TestType)); TestPublicEventsPropagated (typeof (TestType)); @@ -54,6 +57,23 @@ namespace Mono.Linker.Tests.Cases.DataFlow derivedType.BaseType.RequiresAll (); } + class AllPropagatedWithDerivedClass + { + // https://github.com/dotnet/linker/issues/2673 + [ExpectedWarning ("IL2072", nameof (DataFlowTypeExtensions.RequiresAll) + "(Type)", nameof (TestSystemTypeBase.BaseType) + ".get", + ProducedBy = ProducedBy.Analyzer)] + static void TestAllPropagated ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] TestSystemTypeBase derivedType) + { + derivedType.BaseType.RequiresAll (); + } + + [ExpectedWarning ("IL2062", nameof (TestAllPropagated))] + public static void Test () + { + TestAllPropagated (new TestSystemTypeBase ()); + } + } + [ExpectedWarning ("IL2072", nameof (DataFlowTypeExtensions) + "." + nameof (DataFlowTypeExtensions.RequiresPublicConstructors))] static void TestPublicConstructorsAreNotPropagated ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)] Type derivedType) { |