You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
61
mcs/tests/test-throw-expr-01.cs
Normal file
61
mcs/tests/test-throw-expr-01.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using System;
|
||||
|
||||
class X
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
Func<object> f = () => throw null;
|
||||
}
|
||||
|
||||
public int Test () => throw null;
|
||||
|
||||
object Foo ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public object Test2 () => Foo () ?? throw null;
|
||||
|
||||
static void Test3 (out int z) => throw null;
|
||||
|
||||
int this [int x] {
|
||||
get => throw null;
|
||||
}
|
||||
|
||||
public event Action Event {
|
||||
add => throw null;
|
||||
remove => throw null;
|
||||
}
|
||||
|
||||
void TestExpr_1 (bool b)
|
||||
{
|
||||
int x = b ? throw new NullReferenceException () : 1;
|
||||
}
|
||||
|
||||
void TestExpr_2 (bool b)
|
||||
{
|
||||
int x = b ? 2 : throw new NullReferenceException ();
|
||||
}
|
||||
|
||||
void TestExpr_3 (string s)
|
||||
{
|
||||
s = s ?? throw new NullReferenceException ();
|
||||
}
|
||||
|
||||
void TestExpr_4 ()
|
||||
{
|
||||
throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
|
||||
}
|
||||
|
||||
void TestExpr_5 ()
|
||||
{
|
||||
Action a = () => throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
|
||||
}
|
||||
|
||||
static int TestExpr_6 (out int z) => throw null;
|
||||
|
||||
int TestExpr_7 (out int z)
|
||||
{
|
||||
return true ? throw new NullReferenceException () : 1;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user