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

FieldDowncastedToInterface.cs « NoKeptCtorButInterfaceNeeded « OnReferenceType « Inheritance.Interfaces « Mono.Linker.Tests.Cases « Tests « linker - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 84ff1a1c77906291bf1b55168f479677ce9623c6 (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.OnReferenceType.NoKeptCtorButInterfaceNeeded {
	public class FieldDowncastedToInterface {
		[Kept]
		private static Foo f;
		[Kept]
		private static IFoo i;
		
		public static void Main ()
		{
			f = null;
			i = f;
			i.Method ();
		}

		[Kept]
		[KeptInterface (typeof (IFoo))]
		class Foo : IFoo {
			[Kept] // TODO : It should be safe to stub this.  It can't actually be called because no instance of Foo ever exists
			public void Method ()
			{
			}
		}

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