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

ObjectHardCastedToInterface.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: 84b9b6c16623f09c87cf6bc1cb18f83c98800722 (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
using Mono.Linker.Tests.Cases.Expectations.Assertions;

namespace Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoKeptCtor {
	public class ObjectHardCastedToInterface {
		public static void Main ()
		{
			object o = GetAnObject ();
			IFoo i = (IFoo)o;
			UseAnIFoo (i);
			
			// Here to mark Foo so that we can verify the interface is removed
			Foo.Helper ();
		}

		[Kept]
		static object GetAnObject ()
		{
			return null;
		}

		[Kept]
		static void UseAnIFoo (IFoo arg)
		{
		}

		[Kept]
		class Foo : IFoo
		{
			[Kept]
			public static void Helper ()
			{
			}
		}

		[Kept]
		interface IFoo
		{
		}
	}
}