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

LocalDowncastDoesNotCuaseOtherTypesToKeepInterface.cs « NoKeptCtor « 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: 00ad89fd2da0dbc57244aad55b881b426f02eab2 (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
using Mono.Linker.Tests.Cases.Expectations.Assertions;

namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor {
	public class LocalDowncastDoesNotCuaseOtherTypesToKeepInterface {
		public static void Main ()
		{
			Foo f = null;
			IFoo i = f;
			i.Method ();
			DoOtherStuff ();
		}

		[Kept]
		static void DoOtherStuff ()
		{
			HelperToUseBar (null);
		}

		[Kept]
		static void HelperToUseBar (Bar arg)
		{
		}

		[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 ();
		}

		[Kept]
		class Bar : IFoo
		{
			public void Method ()
			{
			}
		}
	}
}