Imported Upstream version 3.8.0

Former-commit-id: 6a76a29bd07d86e57c6c8da45c65ed5447d38a61
This commit is contained in:
Jo Shields
2014-09-04 09:07:35 +01:00
parent a575963da9
commit fe777c5c82
1062 changed files with 12460 additions and 5983 deletions

View File

@@ -6,7 +6,7 @@ thisdir = tests
SUBDIRS =
include ../build/rules.make
DISTFILES = $(wildcard dlls/**/*.cs) $(wildcard dlls/*.cs) $(wildcard dlls/*.inc)
DISTFILES = $(wildcard dlls/**/*.cs) $(wildcard dlls/*.cs) $(wildcard dlls/*.inc) $(wildcard dlls/*.il)
DISTFILES += $(wildcard *.cs) $(wildcard *.il) $(wildcard *.xml) $(wildcard *.inc) $(wildcard known-issues-*) $(wildcard *.snk)
with_mono_path = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"

View File

@@ -0,0 +1,27 @@
.assembly extern mscorlib
{
}
.assembly 'test-883'
{
.publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 // .$..............
00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 // .$..RSA1........
79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF // y..w..:.k.z.t...
CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D // .....t.+...,.4GM
04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE // ..$G.~.h..So.<?.
2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F // /..y...u......[.
35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 // 5.........K$w.P.
DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 // ..tG...'{".G...D
96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD // .t......Pi...(M.
D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF ) // ._F.....x...e...
.hash algorithm 0x00008004
.ver 2:0:0:0
}
.module 'test-883.dll'
.class public auto ansi sealed E
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype E TestField = int32(0x00000003)
}

View File

@@ -4,6 +4,7 @@ public class C
{
public D D { get; private set; }
public string Value { get; private set; }
public Foo Foo { get; set; }
public int Test ()
{
@@ -11,11 +12,19 @@ public class C
return D.Foo (d.Value);
}
public static int Test2 (dynamic d)
{
return Foo.Method(d);
}
public static int Main ()
{
var c = new C ();
if (c.Test () != 1)
return 1;
if (C.Test2 ("s") != 1)
return 2;
return 0;
}
@@ -28,3 +37,11 @@ public struct D
return 1;
}
}
public class Foo
{
public static int Method (string s)
{
return 1;
}
}

View File

@@ -1,18 +0,0 @@
// Compiler options: -t:library
using System;
using System.Runtime.InteropServices;
class A
{
[DllImport ("Dingus", CharSet=CharSet.Auto)]
extern static void Do<T> ();
[DllImport ("Dingus")]
extern static void Do2<T> ();
public static void Main ()
{
}
}

View File

@@ -19,12 +19,8 @@ class C
if (b != "a")
return 1;
int? i = null ?? null;
if (i != null)
return 2;
object z = a ?? null;
if (i != null)
if (z != null)
return 3;
string p = default (string) ?? "a";

View File

@@ -1,7 +1,7 @@
using System;
//
// Parser conditional and cast expression tests
// parser conditional and cast expression tests
//
class A<T>
@@ -31,6 +31,18 @@ public class ConditionalParsing
struct S
{
}
struct MyTestStruct : IDisposable
{
public void Dispose ()
{
}
public static implicit operator MyTestStruct (int i)
{
return new MyTestStruct ();
}
}
void Test_1 (bool a)
{
@@ -129,6 +141,15 @@ public class ConditionalParsing
bool? b = Test (1, arg:2);
}
void Test_17 ()
{
{
using (MyTestStruct? mts = (int?) 1)
{
}
}
}
static void Helper<T> (T arg)
{
}

View File

@@ -15,6 +15,10 @@ class C<T>
static Type simple = typeof (Simple);
}
class D<U> : C<U>
{
}
class A
{
public class N<T>
@@ -30,6 +34,9 @@ class M
if (typeof (TestAlias).ToString () != "A+N`1[System.Double]")
return 1;
if (typeof (D<>.Simple).ToString () != "C`1+Simple[T]")
return 2;
return 0;
}

28
mcs/tests/gtest-614.cs Normal file
View File

@@ -0,0 +1,28 @@
using System;
struct S
{
public static explicit operator int? (S? s)
{
throw new ApplicationException ();
}
public static implicit operator int (S? s)
{
return 2;
}
}
class C
{
public static int Main()
{
int? nn = 3;
S? s = new S ();
int? ret = s ?? nn;
if (ret != 2)
return 1;
return 0;
}
}

37
mcs/tests/gtest-616.cs Normal file
View File

@@ -0,0 +1,37 @@
using System;
struct S : IDisposable
{
public void Dispose ()
{
}
}
class A<T> where T : IDisposable
{
public virtual bool Test<U> (U u) where U : T
{
using (u) {
return false;
}
}
}
class B : A<S>
{
public override bool Test<U> (U u)
{
using (u) {
return true;
}
}
public static int Main ()
{
var b = new B ();
if (!b.Test (new S ()))
return 1;
return 0;
}
}

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

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
foreach (string x in new B ()) {
}
}
}
class A
{
public IEnumerator<string> GetEnumerator ()
{
var s = new List<string>();
s.Add("1");
return s.GetEnumerator();
}
}
class B : A
{
public IEnumerator<int> GetEnumerator (int[] x = null)
{
throw new NotImplementedException ();
}
}

73
mcs/tests/gtest-618.cs Normal file
View File

@@ -0,0 +1,73 @@
using System;
struct S1
{
public static implicit operator int (S1? s)
{
return 1;
}
}
struct S2
{
public static implicit operator int? (S2? s)
{
return null;
}
}
struct S3
{
public static implicit operator int? (S3? s)
{
return 2;
}
}
struct S4
{
public static implicit operator int? (S4 s)
{
return 3;
}
}
class C
{
public static int Main ()
{
S1? s1 = new S1 ();
switch (s1) {
case 1:
break;
default:
return 1;
}
S2? s2 = new S2 ();
switch (s2) {
case null:
break;
default:
return 2;
}
S3? s3 = new S3 ();
switch (s3) {
case 2:
break;
default:
return 3;
}
S4 s4 = new S4 ();
switch (s4) {
case 3:
break;
default:
return 4;
}
return 0;
}
}

35
mcs/tests/gtest-619.cs Normal file
View File

@@ -0,0 +1,35 @@
interface I<T>
{
}
interface IB<T> : I<string>
{
}
struct S
{
class P
{
}
public class C : IB<P>
{
}
}
class M
{
static void Test<T> (I<T> iface)
{
}
static void Test<T> (IB<T> iface)
{
}
static void Main ()
{
Test (new S.C ());
}
}

28
mcs/tests/gtest-620.cs Normal file
View File

@@ -0,0 +1,28 @@
interface I<T>
{
}
class A<T>
{
public virtual T M<U> (U u) where U : T
{
return u;
}
}
class B<W> : A<I<W>>, I<string>
{
public override I<W> M<U> (U u)
{
return u;
}
}
class Bug
{
public static void Main ()
{
var b = new B<string> ();
b.M (b);
}
}

View File

@@ -0,0 +1,52 @@
using System;
struct S
{
public static int P { get; } = 4;
public static int Main ()
{
if (P != 4)
return 1;
var c = new C ();
if (c.P != -3)
return 2;
if (c.P2 != 1)
return 3;
c.P2 = 9;
if (c.P2 != 9)
return 4;
var s = new S2 (null);
if (s.P != 4)
return 12;
if (s.P2 != 1)
return 13;
s.P2 = 9;
if (s.P2 != 9)
return 14;
return 0;
}
}
class C
{
public decimal P { get; } = -3;
public int P2 { get; set; } = 1;
}
struct S2
{
public int P { get; } = 4;
public int P2 { get; set; } = 1;
public S2 (object o)
{
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
class X
{
internal static Dictionary<Type, Func<string, string>> Test = new Dictionary<Type, Func<string, string>> { {
typeof (int),
metadata => "1"
}, {
typeof (uint),
metadata => "2"
},
};
public static void Main ()
{
}
}

View File

@@ -0,0 +1,18 @@
using System;
public struct EventInitializerTest
{
public event Action a;
public event Action b;
public event Action c;
public static void Main()
{
Action d = null;
var eit = new EventInitializerTest() {
a = null,
b = delegate {},
c = d
};
}
}

View File

@@ -0,0 +1,30 @@
using System;
class C
{
static int Foo (Func<short> b)
{
return 1;
}
static int Foo (Func<int> a)
{
return 2;
}
static int Main()
{
if (Foo (() => 1) != 2)
return 1;
if (Foo (() => (short) 1) != 1)
return 2;
if (Foo (() => (byte) 1) != 1)
return 3;
Console.WriteLine ("ok");
return 0;
}
}

View File

@@ -0,0 +1,26 @@
class Test
{
public static void Main ()
{
string p;
M (y: p = F (), x: p);
int i;
string p2;
M2 (out i, c: p2 = F (), b : p2);
}
public static void M (string x, string y)
{
}
static void M2 (out int a, string b, string c)
{
a = 2;
}
public static string F ()
{
return null;
}
}

View File

@@ -0,0 +1,23 @@
using System;
abstract class A
{
public abstract int[] Foo (params int[] args);
}
class B : A
{
public override int[] Foo (int[] args = null)
{
return args;
}
static int Main ()
{
var b = new B();
if (b.Foo().Length != 0)
return 1;
return 0;
}
}

View File

@@ -0,0 +1,72 @@
using System.Runtime.CompilerServices;
using System;
class TestCallerLineNumber
{
static void Test ([CallerLineNumber] object line = null)
{
}
static void Test ([CallerLineNumber] decimal line = 1)
{
}
static void Test ([CallerLineNumber] double line = 1)
{
}
static void Test ([CallerLineNumber] float line = 1)
{
}
static void Test ([CallerLineNumber] int line = 1)
{
}
static void Test ([CallerLineNumber] uint line = uint.MaxValue)
{
}
static void Test ([CallerLineNumber] long line = 1)
{
}
static void Test ([CallerLineNumber] ulong line = 1)
{
}
static void Test ([CallerLineNumber] decimal? line = 1)
{
}
static void Test ([CallerLineNumber] double? line = 1)
{
}
static void Test ([CallerLineNumber] float? line = 1)
{
}
static void Test ([CallerLineNumber] int? line = 1)
{
}
static void Test ([CallerLineNumber] uint? line = uint.MaxValue)
{
}
static void Test ([CallerLineNumber] long? line = 1)
{
}
static void Test ([CallerLineNumber] ulong? line = 1)
{
}
}
class D
{
public static void Main ()
{
}
}

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