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
@@ -170,6 +170,11 @@ public class ConditionalParsing
|
||||
var t = (Int32)sbyte.MaxValue;
|
||||
}
|
||||
|
||||
void Test_22 (bool args)
|
||||
{
|
||||
var x = args ?.2f : -.2f;
|
||||
}
|
||||
|
||||
static void Helper<T> (T arg)
|
||||
{
|
||||
}
|
||||
|
14
mcs/tests/gtest-646-lib.cs
Normal file
14
mcs/tests/gtest-646-lib.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
// Compiler options: -t:library
|
||||
|
||||
public class CompilerBug<T>
|
||||
{
|
||||
public int Foo (CompilerBug<T> p1, CompilerBug<T> p2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int Foo (CompilerBug<object> p1, CompilerBug<T> p2)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
31
mcs/tests/gtest-646.cs
Normal file
31
mcs/tests/gtest-646.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
// Compiler options: -r:gtest-646-lib.dll
|
||||
|
||||
public class LocalBug<T>
|
||||
{
|
||||
public int Foo (LocalBug<T> p1, LocalBug<T> p2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int Foo (LocalBug<object> p1, LocalBug<T> p2)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
class X
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
var o = new CompilerBug<object> ();
|
||||
if (o.Foo (o, o) != 2)
|
||||
return 1;
|
||||
|
||||
var o2 = new LocalBug<object> ();
|
||||
if (o2.Foo (o2, o2) != 2)
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -5,3 +5,4 @@
|
||||
# csXXXX.cs IGNORE : adds test to ignore list
|
||||
|
||||
gtest-230.cs
|
||||
test-pattern-02.cs
|
||||
|
35
mcs/tests/test-943.cs
Normal file
35
mcs/tests/test-943.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public struct MyStruct
|
||||
{
|
||||
public int X { get; set; }
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential, Pack = 1)]
|
||||
public struct MyStruct2
|
||||
{
|
||||
public IntPtr handle;
|
||||
public uint type_reference;
|
||||
}
|
||||
|
||||
class X
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
var s = typeof (MyStruct);
|
||||
|
||||
if (s.StructLayoutAttribute.Size != 0)
|
||||
return 1;
|
||||
|
||||
var s2 = typeof (MyStruct2);
|
||||
|
||||
if (s2.StructLayoutAttribute.Size != 0)
|
||||
return 2;
|
||||
|
||||
if (s2.StructLayoutAttribute.Pack != 1)
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
9
mcs/tests/test-944-lib.cs
Normal file
9
mcs/tests/test-944-lib.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
// Compiler options: -t:library
|
||||
|
||||
public class Class1
|
||||
{
|
||||
public byte[] Finalize ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
10
mcs/tests/test-944.cs
Normal file
10
mcs/tests/test-944.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
// Compiler options: -r:test-944-lib.dll
|
||||
|
||||
public class Class2
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
var writer = new Class1();
|
||||
byte[] bytes = writer.Finalize();
|
||||
}
|
||||
}
|
22
mcs/tests/test-945.cs
Normal file
22
mcs/tests/test-945.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
public abstract class A
|
||||
{
|
||||
public abstract void Bind (string [] args);
|
||||
}
|
||||
|
||||
public class B : A
|
||||
{
|
||||
public override void Bind (params string [] args)
|
||||
{
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
var m = typeof (B).GetMethod ("Bind");
|
||||
var p = m.GetParameters ();
|
||||
var ca = p[0].GetCustomAttributes (false);
|
||||
if (ca.Length != 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
19
mcs/tests/test-946.cs
Normal file
19
mcs/tests/test-946.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
class X
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ImportScope (int scope)
|
||||
{
|
||||
switch (scope) {
|
||||
case 200:
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
29
mcs/tests/test-947.cs
Normal file
29
mcs/tests/test-947.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
interface IA
|
||||
{
|
||||
int Prop { get; }
|
||||
int this [int arg] { get; }
|
||||
}
|
||||
|
||||
abstract class B : IA
|
||||
{
|
||||
public long Prop => 4;
|
||||
|
||||
int IA.Prop => 1;
|
||||
|
||||
public long this [int arg] => 2;
|
||||
|
||||
int IA.this [int arg] => 4;
|
||||
}
|
||||
|
||||
class C : B, IA
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
}
|
||||
|
||||
public new string Prop {
|
||||
get { return ""; }
|
||||
}
|
||||
|
||||
public new string this [int arg] => "2";
|
||||
}
|
@@ -1,4 +1,3 @@
|
||||
// Compiler options: -langversion:experimental
|
||||
using System;
|
||||
|
||||
class DeclarationExpression
|
||||
@@ -14,29 +13,13 @@ class DeclarationExpression
|
||||
return 2;
|
||||
}
|
||||
|
||||
Out (out int o2 = 2);
|
||||
if (o2 != 3)
|
||||
return 3;
|
||||
|
||||
Out (out var o3);
|
||||
if (o3 != 3)
|
||||
return 4;
|
||||
|
||||
Ref (ref int r = 2);
|
||||
if (r != 7)
|
||||
return 5;
|
||||
|
||||
Ref (ref ((var r2 = 3)));
|
||||
if (r2 != 8)
|
||||
return 6;
|
||||
|
||||
// Out2 (str: "b", v: out var o5);
|
||||
// if (o5 != 9)
|
||||
// return 7;
|
||||
|
||||
Out3 (out var o6 = 9m);
|
||||
if (o6.GetType () != typeof (decimal))
|
||||
return 8;
|
||||
Out2 (str: "b", v: out var o5);
|
||||
if (o5 != 9)
|
||||
return 7;
|
||||
|
||||
Console.WriteLine ("ok");
|
||||
return 0;
|
||||
@@ -53,14 +36,4 @@ class DeclarationExpression
|
||||
v = 9;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void Out3<T> (out T t)
|
||||
{
|
||||
t = default (T);
|
||||
}
|
||||
|
||||
static void Ref (ref int arg)
|
||||
{
|
||||
arg += 5;
|
||||
}
|
||||
}
|
@@ -1,27 +1,11 @@
|
||||
// Compiler options: -langversion:experimental
|
||||
using System;
|
||||
|
||||
using static System.Console;
|
||||
|
||||
public class DeclarationExpressions
|
||||
public class C
|
||||
{
|
||||
public static void Main()
|
||||
public static void Main ()
|
||||
{
|
||||
// TODO:
|
||||
//Test (int value = 5);
|
||||
//WriteLine (value);
|
||||
}
|
||||
|
||||
void M2 ()
|
||||
{
|
||||
// for (int i = 0; int v = 2; ++i) {
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
static int Test (int x)
|
||||
{
|
||||
WriteLine (x);
|
||||
return x;
|
||||
}
|
||||
bool Test1 => int.TryParse ("1", out int x);
|
||||
int Test2 => int.TryParse ("2", out int x) ? x : 0;
|
||||
}
|
15
mcs/tests/test-decl-expr-03.cs
Normal file
15
mcs/tests/test-decl-expr-03.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public class C
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
var a = "abcdef";
|
||||
|
||||
var t1 = from x in Foo (a, out var q1) select x;
|
||||
var t2 = from x in a join y in Foo (a, out var q2) on x equals y select x;
|
||||
}
|
||||
|
||||
public static T Foo<T> (T x, out T z) => z = x;
|
||||
}
|
18
mcs/tests/test-decl-expr-04.cs
Normal file
18
mcs/tests/test-decl-expr-04.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
public class C
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
Test2 (Test (out var x1), x1);
|
||||
}
|
||||
|
||||
static int Test (out int x)
|
||||
{
|
||||
x = 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int Test2 (int x, int y)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
@@ -1,5 +1,3 @@
|
||||
// Compiler options: -langversion:experimental
|
||||
|
||||
using System;
|
||||
|
||||
class TypePattern
|
||||
@@ -8,31 +6,14 @@ class TypePattern
|
||||
{
|
||||
object o = 3;
|
||||
bool r = o is System.String t1;
|
||||
if (t1 != null)
|
||||
return 1;
|
||||
|
||||
if (r)
|
||||
return 2;
|
||||
|
||||
if (o is string t2)
|
||||
return 3;
|
||||
|
||||
if (t2 != null)
|
||||
return 4;
|
||||
|
||||
object o2 = (int?) 4;
|
||||
bool r2 = o2 is byte? t3;
|
||||
|
||||
if (t3 != null)
|
||||
return 5;
|
||||
|
||||
if (r2)
|
||||
return 6;
|
||||
|
||||
long? l = 5;
|
||||
bool r3 = l is long t4;
|
||||
if (t4 != 5)
|
||||
return 7;
|
||||
|
||||
if (!r3)
|
||||
return 8;
|
||||
@@ -40,4 +21,22 @@ class TypePattern
|
||||
Console.WriteLine ("ok");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Test1 (object arg)
|
||||
{
|
||||
while (arg is int b) {
|
||||
b = 2;
|
||||
}
|
||||
}
|
||||
|
||||
static string Test2 (object arg)
|
||||
{
|
||||
if (arg is string s) {
|
||||
return s;
|
||||
} else {
|
||||
s = "";
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
@@ -48,14 +48,14 @@ class ConstantPattern
|
||||
|
||||
object o4 = (byte?)255;
|
||||
var ggg = o4 is 255;
|
||||
if (!ggg)
|
||||
if (ggg)
|
||||
return 8;
|
||||
|
||||
if (o4 is null)
|
||||
return 9;
|
||||
|
||||
object o5 = (double)-255;
|
||||
if (!(o5 is -byte.MaxValue))
|
||||
if (o5 is -byte.MaxValue)
|
||||
return 10;
|
||||
|
||||
object o6 = MyEnum.V_4;
|
||||
|
21
mcs/tests/test-static-using-13.cs
Normal file
21
mcs/tests/test-static-using-13.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using static TestClass;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
var res = Directions.Up;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Directions
|
||||
{
|
||||
Up,
|
||||
NotUp,
|
||||
}
|
||||
|
||||
public static class TestClass
|
||||
{
|
||||
public static int Directions;
|
||||
}
|
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;
|
||||
}
|
||||
}
|
22
mcs/tests/test-throw-expr-02.cs
Normal file
22
mcs/tests/test-throw-expr-02.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
Console.WriteLine (M (1));
|
||||
try {
|
||||
Console.WriteLine (M (null));
|
||||
} catch (Exception) {
|
||||
Console.WriteLine ("thrown");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static string M (object data)
|
||||
{
|
||||
return data?.ToString () ?? throw null;
|
||||
}
|
||||
}
|
@@ -1 +1 @@
|
||||
2e58c85cfbb48e2bce2202609a0d7c4bba1aa697
|
||||
c0c676d6cdef0f51a5d571bc37d9e9004e1fa245
|
Reference in New Issue
Block a user