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

gtest-544.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 98dd222721d73aaa6b529eed13b305b9cb0bf487 (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
using System;

public abstract class A<T>
{
	public abstract G Foo<G> () where G : T;
	
	public virtual G Foo2<G> () where G : T
	{
		return default (G);
	}
}

public class B : A<int?>
{
	public override G Foo<G> ()
	{
		return new G ();
	}
	
	public override G Foo2<G> ()
	{
		return base.Foo2<G> ();
	}
}

abstract class A2<T>
{
	public abstract void Foo<U> () where U : struct, T;
}

class B2 : A2<System.ValueType>
{
	public override void Foo<Y> ()
	{
	}
}

abstract class A3<T>
{
	public abstract void Foo<U> () where U : class, T;
}

class B3 : A3<System.Object>
{
	public override void Foo<Y> ()
	{
	}
}

class Program
{
	public static int Main ()
	{
		var b = new B ();
		if (b.Foo<int?> () == null)
			return 0;
		
		b.Foo2<int?> ();
		
		var b2 = new B2 ();
		b2.Foo<byte> ();
		
		var b3 = new B3 ();
		b3.Foo<string> ();
		
		return 1;
	}
}