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

InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod.cs « NoKeptCtor « OnValueType « Inheritance.Interfaces « Mono.Linker.Tests.Cases « test - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 54680898a6f571d932473450ddb8b75060abc948 (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
using Mono.Linker.Tests.Cases.Expectations.Assertions;

namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnValueType.NoKeptCtor {
	public class InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod {
		public static void Main ()
		{
			StaticMethodOnlyUsed.StaticMethod ();
			
			// We are testing removing interfaces when no instance is created, we need to mark the interface types
			// so that we don't end up testing unused interface types being swept
			var tmp = typeof (IUsedInterface).ToString ();
		}

		[Kept] // Could be removed in the future with improved handling of value types
		interface IUsedInterface {
			void Foo ();
		}

		[Kept]
		[KeptInterface (typeof (IUsedInterface))] // Could be removed in the future with improved handling of value types
		struct StaticMethodOnlyUsed : IUsedInterface {
			public void Foo ()
			{
			}

			[Kept]
			public static void StaticMethod ()
			{
			}
		}
	}
}