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

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

namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods
{
	class VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly
	{
		public static void Main ()
		{
			new A ().Foo ();
		}

		[KeptMember (".ctor()")]
		class B
		{
			// TODO: Would be nice to be removed
			// https://github.com/dotnet/linker/issues/3097
			[KeptBy (typeof (A), nameof (A.Foo), "BaseMethod")]
			public virtual void Foo ()
			{
			}
		}

		[KeptMember (".ctor()")]
		[KeptBaseType (typeof (B))]
		class A : B
		{
			// Bug: https://github.com/dotnet/linker/issues/3078
			// Linker should mark for DirectCall as well as OverrideOnInstantiatedType, not just OverrideOnInstantiatedType
			//[KeptBy (typeof(A), nameof(Foo), DependencyKind.DirectCall)]
			[KeptBy (typeof (A), "OverrideOnInstantiatedType")]
			public override void Foo ()
			{
			}
		}
	}
}