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
path: root/test
diff options
context:
space:
mode:
authorVitek Karas <10670590+vitek-karas@users.noreply.github.com>2022-04-26 15:54:24 +0300
committerGitHub <noreply@github.com>2022-04-26 15:54:24 +0300
commit0504b19a22c6d974eb44c29d0eeae9a5b5a4201e (patch)
tree74931bea12ac96489a93b3d0f8e0922c7b2880a0 /test
parent4418cce12192f379b9b4d5baa111812e40707f84 (diff)
Add a test for RUC on type with override method (#2764)
The analyzer produces warning in this case which the linker doesn't. Test for bug https://github.com/dotnet/linker/issues/2763
Diffstat (limited to 'test')
-rw-r--r--test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs b/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs
index 9f1dc8b45..a3fea5787 100644
--- a/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs
+++ b/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs
@@ -315,6 +315,23 @@ namespace Mono.Linker.Tests.Cases.RequiresCapability
public override void Method () { }
}
+ class BaseWithNoRequires
+ {
+ public virtual void Method () { }
+ }
+
+ [RequiresUnreferencedCode ("RUC")]
+ [RequiresDynamicCode ("RDC")]
+ class DerivedWithRequiresOnTypeOverBaseWithNoRequires : BaseWithNoRequires
+ {
+ // https://github.com/dotnet/linker/issues/2763
+ [ExpectedWarning ("IL2046", ProducedBy = ProducedBy.Analyzer)]
+ [ExpectedWarning ("IL3051", ProducedBy = ProducedBy.Analyzer)]
+ public override void Method ()
+ {
+ }
+ }
+
public interface InterfaceWithoutRequires
{
[RequiresUnreferencedCode ("RUC")]
@@ -502,6 +519,9 @@ namespace Mono.Linker.Tests.Cases.RequiresCapability
// Doesn't warn since DerivedWithoutRequiresOnType has no static methods
typeof (DerivedWithoutRequiresOnType).RequiresPublicMethods ();
+
+ // Doesn't warn since the type has no statics
+ typeof (DerivedWithRequiresOnTypeOverBaseWithNoRequires).RequiresPublicMethods ();
}
[ExpectedWarning ("IL2026", "BaseWithoutRequiresOnType.Method()")]