Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -61,7 +61,7 @@ build-compiler-lib:
cd ../class/Mono.CSharp && $(MAKE) NO_DIR_CHECK=yes
qcheck: build-compiler-lib qcheck2
qcheck2:
$(TESTER) -mode:pos -files:$(TEST_PATTERN) -compiler:$(COMPILER) -issues:known-issues-$(PROFILE) -log:$(PROFILE).log -il:ver-il-$(PROFILE).xml $(DEFINES) $(TOPTIONS)

View File

@@ -160,6 +160,11 @@ public class ConditionalParsing
var x = 1 > 0 ? table[5, 1] : 0;
}
void Test_20 ()
{
var t = (Object)string.Empty;
}
static void Helper<T> (T arg)
{
}

30
mcs/tests/gtest-626.cs Normal file
View File

@@ -0,0 +1,30 @@
using System;
class Program
{
public class Foo
{
public static bool MG (Foo t)
{
return false;
}
}
public class Bar<T>
{
public static Bar<T> Create (Func<T, bool> a)
{
return null;
}
public static Bar<T> Create (Func<T, double> a, Func<T, bool> b = null)
{
throw new ApplicationException ();
}
}
static void Main ()
{
var x = Bar<Foo>.Create (Foo.MG);
}
}

19
mcs/tests/gtest-627.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
class X
{
public static U Foo<U> (double? value, Func<double?, U> f, int dv = 0)
{
throw new ApplicationException ();
}
public static U Foo<T, U> (T? source, Func<T, U> f) where T : struct
{
return default (U);
}
static void Main (string[] args)
{
Foo (default (double?), v => v / 100);
}
}

20
mcs/tests/gtest-628.cs Normal file
View File

@@ -0,0 +1,20 @@
using System;
using System.Threading;
class Impl<T> where T : class
{
public static object CompareExchangeImpl (TypedReference tr, object value, object comparand)
{
return Interlocked.CompareExchange (ref __refvalue(tr, T), (T) value, (T) comparand);
}
}
class X
{
public static void Main ()
{
var obj = "obj";
var tr = __makeref (obj);
Impl<string>.CompareExchangeImpl (tr, "foo", null);
}
}

20
mcs/tests/gtest-629.cs Normal file
View File

@@ -0,0 +1,20 @@
// Compiler options: -unsafe
using System;
using System.Collections.Generic;
public class Program
{
public unsafe static void Main ()
{
var list = new List<object> () { "" };
fixed (char *c = (string)list[0]) {
}
var list2 = new List<object> () { null };
fixed (byte* p = (byte[])list2[0]) {
}
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Reflection;
public class Test
{
public string Property1 { get; }
public int Property2 { get; }
public static int Main ()
{
var t = new Test ();
if (t.Property1 != null)
return 1;
if (t.Property2 != 0)
return 2;
var fields = typeof (Test).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
if (fields.Length != 2)
return 3;
foreach (var fi in fields) {
if ((fi.Attributes & FieldAttributes.InitOnly) == 0)
return 4;
}
return 0;
}
}

View File

@@ -0,0 +1,48 @@
using System;
public class A
{
public int X { get; }
public virtual int Y { get; }
public A ()
{
X = 4;
X++;
Y = 2;
Y++;
}
}
class B : A
{
int i_get;
public override int Y { get { ++i_get; return base.Y; } }
public static int Main ()
{
var a = new A ();
if (a.X != 5)
return 1;
if (a.Y != 3)
return 2;
var b = new B ();
if (b.X != 5)
return 3;
if (b.i_get != 1)
return 4;
if (b.Y != 3)
return 5;
if (b.i_get != 2)
return 6;
return 0;
}
}

View File

@@ -0,0 +1,22 @@
using System;
public struct S
{
public int X { get; }
public int Y { get; }
public S ()
{
X = 4;
Y = X;
}
public static int Main()
{
var s = new S ();
if (s.Y != 4)
return 1;
return 0;
}
}

View File

@@ -0,0 +1,14 @@
public struct S
{
public int A { get; set;}
public S (int a)
{
this.A = a;
}
public static void Main ()
{
}
}

View File

@@ -0,0 +1,8 @@
public class C
{
public virtual int A { get; private set; }
public static void Main ()
{
}
}

View File

@@ -0,0 +1,13 @@
abstract class A
{
public abstract int Foo { get; }
}
class B : A
{
public override int Foo => 1;
public static void Main ()
{
}
}

View File

@@ -730,6 +730,13 @@ class Tester
e9.Compile ().Invoke (1);
}
void CallTest_10 ()
{
Expression<Func<string>> e = () => $"{int.MaxValue}";
AssertNodeType (e, ExpressionType.Call);
Assert (int.MaxValue.ToString (), e.Compile ().Invoke ());
}
void CoalesceTest ()
{
Expression<Func<uint?, uint>> e = (uint? a) => a ?? 99;

View File

@@ -0,0 +1,11 @@
using System;
using System.Runtime.InteropServices;
public static class MainClass
{
public static void Main (string[] args)
{
}
public delegate Int32 FooDelegate ([In, Optional] int foo);
}

View File

@@ -54,17 +54,7 @@ class Test
if ((typeof (X2).Attributes & TypeAttributes.BeforeFieldInit) == 0)
return 2;
#if NET_2_0
ConstructorInfo mi = typeof(C).GetConstructors ()[0];
MethodBody mb = mi.GetMethodBody();
if (mb.GetILAsByteArray ().Length != 7) {
Console.WriteLine("Optimization failed");
return 3;
}
#endif
Console.WriteLine ("OK");
return 0;
}
}
}

View File

@@ -1,4 +1,4 @@
// Compiler options: -r:../class/lib/net_2_0/Mono.Cecil.dll
// Compiler options: -r:../class/lib/net_4_5/Mono.Cecil.dll
using System;
using System.IO;

View File

@@ -1,4 +1,4 @@
// Compiler options: -r:../class/lib/net_2_0/Mono.Cecil.dll
// Compiler options: -r:../class/lib/net_4_5/Mono.Cecil.dll
using System;
using Mono.Cecil;

View File

@@ -8,6 +8,7 @@ using System.Reflection;
[assembly: AssemblyTrademark ("Trademark")]
[assembly: AssemblyVersion ("5.4.3.1")]
[assembly: AssemblyFileVersion ("8.9")]
[assembly: AssemblyTitle ("Title")]
class C
{
@@ -22,8 +23,8 @@ class C
if (fv.CompanyName != "Company")
return 2;
// if (fv.Comments != "Description")
// return 3;
if (fv.Comments != "Description")
return 3;
if (fv.LegalCopyright != "Copyright")
return 4;
@@ -34,6 +35,9 @@ class C
if (fv.ProductVersion != "8.9")
return 6;
if (fv.FileDescription != "Title")
return 7;
return 0;
}
}

14
mcs/tests/test-908.cs Normal file
View File

@@ -0,0 +1,14 @@
// Compiler options: -warnaserror
public class Test
{
#pragma warning disable public
#pragma warning disable CS1685
#pragma warning disable CS1700, 1701
public static void Main ()
{
}
#pragma warning restore CS1685
#pragma warning restore public, 1701
}

17
mcs/tests/test-909.cs Normal file
View File

@@ -0,0 +1,17 @@
using System;
public struct S
{
public int A { get; private set;}
public event EventHandler eh;
public S (int a)
{
this.eh = null;
A = a;
}
public static void Main ()
{
}
}

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