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
|
using System;
//
// Parser conditional expression tests
//
public class ConditionalParsing
{
class T
{
public T (string path, bool mode)
: this (path, mode, (mode == true ? 1 : 2), 1, int.MaxValue)
{
}
public T (string s, bool m, int i, int i2, int i3)
{
}
}
class Const
{
const int c = true ? 1 : 2;
}
struct S
{
}
void Test_1 (bool a)
{
int? b = a ? 3 : 4;
}
void Test_2 ()
{
string mp = "";
int a = 1;
int _provider = mp.Length == a ? _provider = 4 : 5;
}
T? Test_3<T> (Func<T, T, T> result, T t) where T : struct
{
return new T? (result (t, t));
}
void Test_4 (bool x, bool y)
{
int s = x ? (y ? 2 : 4) : (y ? 5 : 7);
}
void Test_5 (bool a, IDisposable fs)
{
using (a ? fs : null) {
Console.WriteLine ("");
}
}
void Test_6 (bool a)
{
char[] escaped_text_chars =
a != false ?
new char [] {'&', '<', '>', '\r', '\n'} :
new char [] {'&', '<', '>'};
}
void Test_7 (object o)
{
object a = (S?[]) o;
}
void Test_8 (DateTime value)
{
var _endDate = value > DateTime.MinValue ? new DateTime ? (value) : null;
}
void Test_9 ()
{
bool b = (1 == 2);
bool c = (1 == 1);
string a = (b ? (c ? "#" : "#") : "");
}
public static void Main ()
{
}
}
|