Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@ -6,6 +6,11 @@ namespace testcase
{
public static int Main ()
{
DateTime? dt = null;
var res1 = default (DateTime?) == dt;
if (!res1)
return 5;
DateTime? a = default (DateTime?);
DateTime? b = default (DateTime?);
bool res = a == b;

View File

@ -66,6 +66,14 @@ class C
if ((s & e) != null)
return 15;
var res1 = (E?) 1 == null;
if (res1)
return 16;
var res2 = null == (E?) 1;
if (res2)
return 17;
Console.WriteLine ("ok");
return 0;

29
mcs/tests/gtest-621.cs Normal file
View File

@ -0,0 +1,29 @@
using System;
class X
{
static int Main ()
{
int? intArg = 1;
long? longArg = 2;
var g = intArg ?? longArg;
Console.WriteLine (g);
if (g != 1)
return 1;
intArg = null;
g = intArg ?? longArg;
Console.WriteLine (g);
if (g != 2)
return 2;
longArg = null;
g = intArg ?? longArg;
Console.WriteLine (g);
if (g != null)
return 3;
return 0;
}
}

25
mcs/tests/gtest-622.cs Normal file
View File

@ -0,0 +1,25 @@
interface IX<TI>
{
void M<TO> () where TO : TI;
}
interface IY
{
}
class CY : IY
{
}
class A : IX<IY>
{
public void M<TO> () where TO : IY
{
}
public static void Main ()
{
var a = new A ();
a.M<CY> ();
}
}

View File

@ -3,6 +3,7 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Diagnostics;
public class Test
{
@ -14,10 +15,12 @@ public class Test
if (!(fields.Length > 0))
return 1;
object [] field_atts = fields[0].GetCustomAttributes (false);
if (!(field_atts.Length > 0))
if (field_atts.Length != 2)
return 2;
if (field_atts[0].GetType() != typeof (CompilerGeneratedAttribute))
if (field_atts[0].GetType() != typeof (DebuggerBrowsableAttribute))
return 3;
if (field_atts[1].GetType() != typeof (CompilerGeneratedAttribute))
return 4;
if (fields [0].Name != "<Foo>k__BackingField")
return 10;

View File

@ -4,11 +4,16 @@ struct S
{
public static int P { get; } = 4;
public static int[] PA { get; } = { 0, 2 };
public static int Main ()
{
if (P != 4)
return 1;
if (PA [1] != 2)
return 10;
var c = new C ();
if (c.P != -3)
return 2;

View File

@ -3,6 +3,12 @@
using System;
public enum FooEnum
{
One,
Two
};
class Foo
{
public static int y = 1;
@ -41,4 +47,22 @@ class Foo
return s;
}
const FooEnum foo = FooEnum.Two;
static void Test_3 ()
{
object obj;
switch (foo) {
case FooEnum.One:
obj = new object ();
break;
case FooEnum.Two:
obj = new object ();
break;
}
Console.WriteLine (obj);
}
}

View File

@ -26,6 +26,21 @@
}
}
.class public auto ansi beforefieldinit A2
extends [mscorlib]System.Attribute
{
.custom instance void class [mscorlib]System.AttributeUsageAttribute::'.ctor'(valuetype ['missing-lib']System.AttributeTargets) = (01 00 80 00 00 00 00 00 ) // ........
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
ldarg.0
call instance void [mscorlib]System.Attribute::.ctor()
ret
}
}
.class public auto ansi beforefieldinit X extends [mscorlib]System.Object
{
.custom instance void A::.ctor(class [mscorlib]System.Type) = ( 01 00 44 58 58 2C 20 62 75 67 2D 31 2D 6C 69 62 // ..DXX, missing-lib

View File

@ -2,6 +2,7 @@
// Compilation test only for missing 2nd level dependecies
[A2]
class Program
{
void Test ()

View File

@ -57,7 +57,18 @@ public class A
{
int f = 1;
int g;
return f > 1 && OutCall (out g) && g > 1;
return f > 1 && OutCall (out g) && g > 1;
}
static void Test8 ()
{
bool x = true;
int a;
if (x ? OutCall (out a) : OutCall (out a))
System.Console.WriteLine (a);
else
System.Console.WriteLine (a);
}
static bool OutCall (out int arg)

View File

@ -1,24 +0,0 @@
using System;
// C#6 change
struct S1
{
S2 s2;
public S1 (int arg)
{
}
}
struct S2
{
int field;
}
class X
{
public static void Main ()
{
}
}

22
mcs/tests/test-903.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
struct S
{
}
class C
{
public static implicit operator S (C c)
{
return new S ();
}
}
class Program
{
static void Main ()
{
C c = new C ();
var x = c ?? new S ();
}
}

35
mcs/tests/test-904.cs Normal file
View File

@ -0,0 +1,35 @@
using System;
class Test
{
public static bool Foo (out int v)
{
v = 0;
return false;
}
static void Main()
{
bool b = false;
int a1;
var r1 = (false || Foo (out a1)) ? a1 : 1;
int a2;
var r2 = (true && Foo (out a2)) ? 2 : a2;
int a3;
var r3 = (b || Foo (out a3)) && Foo (out a3);
int b3 = a3;
int a4;
var r4 = ((b || Foo (out a4)) && Foo (out a4));
int b4 = a4;
int a5;
if ((b || Foo (out a5)) && (b || Foo (out a5)))
Console.WriteLine ();
else
Console.WriteLine (a5);
}
}

13
mcs/tests/test-905.cs Normal file
View File

@ -0,0 +1,13 @@
using System;
using i = System.Int16;
enum E : i
{
}
class X
{
public static void Main ()
{
}
}

View File

@ -1,4 +1,3 @@
// Compiler options: -langversion:future
using System;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,5 +1,3 @@
// Compiler options: -langversion:future
using System;
using System.Threading.Tasks;
using System.Threading;

View File

@ -1,5 +1,3 @@
// Compiler options: -langversion:future
using System;
using System.Threading.Tasks;
using System.Threading;

View File

@ -1,5 +1,3 @@
// Compiler options: -langversion:future
using System;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,5 +1,3 @@
// Compiler options: -langversion:future
using System;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,5 +1,3 @@
// Compiler options: -langversion:future
using System;
using System.Threading.Tasks;

Some files were not shown because too many files have changed in this diff Show More