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

DynamicDependencyPreservesInterfaceMethod.cs « NoKeptCtor « OnReferenceType « Inheritance.Interfaces « Mono.Linker.Tests.Cases « test - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d6233a6358003fdd4d51af11ad1a79d4ca911551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor
{
	/// <summary>
	/// The interface can still be removed in this case because PreserveDependency is just preserving Foo() on the current type
	/// </summary>
	public class DynamicDependencyPreservesInterfaceMethod
	{
		public static void Main ()
		{
			StaticMethodOnlyUsed.StaticMethod ();
		}

		interface IUnusedInterface
		{
			void Foo ();
		}

		[Kept]
		class StaticMethodOnlyUsed : IUnusedInterface
		{
			[Kept]
			public void Foo ()
			{
			}

			[Kept]
			[DynamicDependency ("Foo")]
			public static void StaticMethod ()
			{
			}
		}
	}
}