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

OverrideThatAlsoFulfilsInterface.cs « OverrideRemoval « NoKeptCtor « Inheritance.AbstractClasses « Mono.Linker.Tests.Cases « Tests « linker - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 428310dadd46e5802cd77872ade1a6ee9e6e0966 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Mono.Linker.Tests.Cases.Expectations.Assertions;

namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval {
	public class OverrideThatAlsoFulfilsInterface {
		public static void Main ()
		{
			Base b = HelperToMarkFooAndRequireBase ();
			b.Method ();

			MethodToUseTheInterface ();
		}

		[Kept]
		static void MethodToUseTheInterface ()
		{
			// Now use the interface method so that it is kept
			IFoo f = new Bar ();
			f.Method ();
		}

		[Kept]
		static Foo HelperToMarkFooAndRequireBase ()
		{
			return null;
		}

		[Kept]
		class Base {
			[Kept]
			public virtual void Method ()
			{
			}
		}

		[Kept]
		interface IFoo {
			[Kept]
			void Method ();
		}

		[Kept]
		[KeptMember (".ctor()")]
		[KeptInterface (typeof (IFoo))]
		class Bar : IFoo {
			[Kept]
			public void Method ()
			{
			}
		}

		[Kept]
		[KeptBaseType (typeof (Base))]
		class Foo : Base, IFoo {
			public override void Method ()
			{
			}
		}
	}
}