Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-throw-expr-01.cs
1 using System;
2
3 class X
4 {
5         public static void Main ()
6         {
7                 Func<object> f = () => throw null;
8         }
9
10         public int Test () => throw null;
11
12         object Foo ()
13         {
14                 return null;
15         }
16
17         public object Test2 () => Foo () ?? throw null;
18
19         static void Test3 (out int z) => throw null;
20
21         int this [int x] {
22                 get => throw null;
23         }    
24
25         public event Action Event {
26                 add => throw null; 
27                 remove => throw null;
28         }
29
30         void TestExpr_1 (bool b)
31         {
32                 int x = b ? throw new NullReferenceException () : 1;        
33         }
34
35         void TestExpr_2 (bool b)
36         {
37                 int x = b ? 2 : throw new NullReferenceException ();
38         }
39
40         void TestExpr_3 (string s)
41         {
42                 s = s ?? throw new NullReferenceException ();
43         }
44
45         void TestExpr_4 ()
46         {
47                 throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
48         }
49
50         void TestExpr_5 ()
51         {
52                 Action a = () => throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
53         }
54
55         static int TestExpr_6 (out int z) => throw null;
56
57         int TestExpr_7 (out int z)
58         {
59                 return true ? throw new NullReferenceException () : 1;
60         }
61 }