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

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

struct S
{
}

abstract class B1<T1, T2>
{
	public abstract void Test<U> (U x) where U : struct, T1, T2;
}

abstract class B2<T1, T2>
{
	public abstract void Test<U> (U x) where U : class, T1, T2;
}

class C1 : B1<S, ValueType>
{
	public override void Test<U> (U x)
	{
	}
}

class C2 : B2<string, object>
{
	public override void Test<U> (U x)
	{
	}
}

class Test
{
	public static int Main ()
	{
		var m = typeof (C1).GetMethod ("Test");
		var ta = m.GetGenericArguments ()[0].GetGenericParameterConstraints ();
		if (ta.Length != 2)
			return 1;
		
		m = typeof (C2).GetMethod ("Test");
		ta = m.GetGenericArguments ()[0].GetGenericParameterConstraints ();
		if (ta.Length != 1)
			return 2;

		Console.WriteLine ("ok");
		return 0;
	}
}