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

OverrideOfAbstractInUnmarkedClassIsRemoved.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: 366fd6a3f34f01b7f5a31c87da0972ea127fded4 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

namespace Mono.Linker.Tests.Cases.Inheritance.VirtualMethods
{
	public class OverrideOfAbstractInUnmarkedClassIsRemoved
	{
		[Kept]
		public static void Main ()
		{
			MarkedBase x = new MarkedDerived ();
			x.Method ();

			UsedSecondLevelTypeWithAbstractBase y = new ();
			y.Method ();

			UsedSecondLevelType z = new ();
			z.Method ();
		}

		[Kept]
		[KeptMember (".ctor()")]
		abstract class MarkedBase
		{
			[Kept]
			public abstract int Method ();
		}

		[Kept]
		[KeptMember (".ctor()")]
		[KeptBaseType (typeof (MarkedBase))]
		class MarkedDerived : MarkedBase
		{
			[Kept]
			public override int Method () => 1;
		}

		class UnmarkedDerived : MarkedBase
		{
			public override int Method () => 1;
		}

		[Kept]
		[KeptMember (".ctor()")]
		[KeptBaseType (typeof (MarkedBase))]
		class UnusedIntermediateType : MarkedBase
		{
			[Kept]
			public override int Method () => 1;
		}

		[Kept]
		[KeptMember (".ctor()")]
		[KeptBaseType (typeof (UnusedIntermediateType))]
		class UsedSecondLevelType : UnusedIntermediateType
		{
			[Kept]
			public override int Method () => 1;
		}

		[Kept]
		[KeptMember (".ctor()")]
		[KeptBaseType (typeof (MarkedBase))]
		abstract class UnusedIntermediateTypeWithAbstractOverride : MarkedBase
		{
			[Kept]
			public abstract override int Method ();
		}

		[Kept]
		[KeptMember (".ctor()")]
		[KeptBaseType (typeof (UnusedIntermediateTypeWithAbstractOverride))]
		class UsedSecondLevelTypeWithAbstractBase : UnusedIntermediateTypeWithAbstractOverride
		{
			[Kept]
			public override int Method () => 1;
		}

		class UnusedSecondLevelTypeWithAbstractBase : UnusedIntermediateTypeWithAbstractOverride
		{
			public override int Method () => 1;
		}

		class UnusedSecondLevelType : UnusedIntermediateType
		{
			public override int Method () => 1;
		}
	}
}