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

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

interface IIn<in T>
{
}

interface IOut<out T>
{
}

class A<T> : IIn<T>, IOut<T>
{
}

class C
{
	public static int Main ()
	{
		IIn<string> a_string = new A<string> ();
		IIn<object> a_object = new A<object> ();

		if (!(a_string is IIn<string>))
			return 1;
		
		if ((a_string is IIn<object>))
			return 2;
		
		if (!(a_object is IIn<string>))
			return 3;
		
		if (!(a_object is IIn<object>))
			return 4;

		IOut<string> b_string = new A<string> ();
		IOut<object> b_object = new A<object> ();

		if (!(b_string is IOut<string>))
			return 10;
		
		if (!(b_string is IOut<object>))
			return 11;
		
		if (b_object is IOut<string>)
			return 12;
		
		if (!(b_object is IOut<object>))
			return 13;
		
		Console.WriteLine ("OK");
		return 0;
	}
}