You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
24
mcs/tests/dtest-060.cs
Normal file
24
mcs/tests/dtest-060.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Test
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
dynamic d = 0L;
|
||||
return C.M<Program> (d);
|
||||
}
|
||||
}
|
||||
|
||||
public class C
|
||||
{
|
||||
public static int M<T> (int i) where T : C
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int M<T> (long l)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
63
mcs/tests/dtest-061.cs
Normal file
63
mcs/tests/dtest-061.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static int[] testValues = {0, -1, 200, -200, 32, -32, 64, -128, 333, 5};
|
||||
|
||||
dynamic dynBase;
|
||||
dynamic dynAmt;
|
||||
|
||||
int? optBase;
|
||||
int? optAmt;
|
||||
|
||||
int normBase;
|
||||
int normAmt;
|
||||
|
||||
dynamic uDynBase;
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
var tester = new Program ();
|
||||
|
||||
foreach (int baseVal in testValues)
|
||||
foreach (int amt in testValues)
|
||||
tester.ShiftTest (baseVal, amt);
|
||||
}
|
||||
|
||||
public static void AreEqual<A, B> (A a, B b)
|
||||
{
|
||||
if (!a.Equals (b))
|
||||
throw new Exception (
|
||||
String.Format (
|
||||
"Shift Equality Assertion Failed: Had {0} and expected {1}", a, b));
|
||||
}
|
||||
|
||||
public void ShiftTest (int shiftBase, int shiftAmt)
|
||||
{
|
||||
optBase = dynBase = normBase = shiftBase;
|
||||
optAmt = dynAmt = normAmt = shiftAmt;
|
||||
int immediate = shiftBase << shiftAmt;
|
||||
|
||||
AreEqual<int?, int?> (dynBase << dynAmt, immediate);
|
||||
AreEqual<int?, int?> (dynBase << optAmt, immediate);
|
||||
AreEqual<int?, int?> (dynBase << normAmt, immediate);
|
||||
|
||||
AreEqual<int?, int?> (optBase << dynAmt, immediate);
|
||||
AreEqual<int?, int?> (optBase << optAmt, immediate);
|
||||
AreEqual<int?, int?> (optBase << normAmt, immediate);
|
||||
|
||||
AreEqual<int?, int?> (normBase << dynAmt, immediate);
|
||||
AreEqual<int?, int?> (normBase << optAmt, immediate);
|
||||
AreEqual<int?, int?> (normBase << normAmt, immediate);
|
||||
|
||||
uint uShiftBase = (uint)shiftBase;
|
||||
uDynBase = uShiftBase;
|
||||
|
||||
AreEqual<uint?, uint?> (uShiftBase << dynAmt, uDynBase << dynAmt);
|
||||
AreEqual<uint?, uint?> (uShiftBase << optAmt, uDynBase << optAmt);
|
||||
AreEqual<uint?, uint?> (uShiftBase << normAmt, uDynBase << normAmt);
|
||||
}
|
||||
}
|
||||
}
|
18
mcs/tests/dtest-optional-02.cs
Normal file
18
mcs/tests/dtest-optional-02.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class Test
|
||||
{
|
||||
public static object Foo ([Optional, DefaultParameterValue (1)] dynamic i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
var res = (int) Foo ();
|
||||
if (res != 1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
25
mcs/tests/gtest-630.cs
Normal file
25
mcs/tests/gtest-630.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
public interface IA
|
||||
{
|
||||
int Foo (int x = 0);
|
||||
}
|
||||
|
||||
public class A : IA
|
||||
{
|
||||
public int Foo (int x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
private static int Bar<T> (T x) where T : A, IA
|
||||
{
|
||||
return x.Foo ();
|
||||
}
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
if (Bar (new A ()) != 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
22
mcs/tests/gtest-631.cs
Normal file
22
mcs/tests/gtest-631.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
public class BaseClass<TSource>
|
||||
{
|
||||
public void DoStuff<TInput> (TInput stuff) where TInput: TSource
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class MyClass: BaseClass<TInterface>, MyInterface
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public interface TInterface
|
||||
{
|
||||
}
|
||||
|
||||
public interface MyInterface
|
||||
{
|
||||
void DoStuff<TInput> (TInput stuff) where TInput: TInterface;
|
||||
}
|
22
mcs/tests/gtest-632.cs
Normal file
22
mcs/tests/gtest-632.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
public class BaseClass<TSource>
|
||||
{
|
||||
public void DoStuff<TInput> (TInput stuff) where TInput: TSource
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class MyClass: BaseClass<TInterface>, MyInterface
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class TInterface
|
||||
{
|
||||
}
|
||||
|
||||
public interface MyInterface
|
||||
{
|
||||
void DoStuff<TInput> (TInput stuff) where TInput: TInterface;
|
||||
}
|
@@ -17,9 +17,9 @@ public class Test
|
||||
object [] field_atts = fields[0].GetCustomAttributes (false);
|
||||
if (field_atts.Length != 2)
|
||||
return 2;
|
||||
if (field_atts[0].GetType() != typeof (DebuggerBrowsableAttribute))
|
||||
if (field_atts[1].GetType() != typeof (DebuggerBrowsableAttribute))
|
||||
return 3;
|
||||
if (field_atts[1].GetType() != typeof (CompilerGeneratedAttribute))
|
||||
if (field_atts[0].GetType() != typeof (CompilerGeneratedAttribute))
|
||||
return 4;
|
||||
|
||||
if (fields [0].Name != "<Foo>k__BackingField")
|
||||
|
@@ -1,22 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
18
mcs/tests/gtest-autoproperty-17.cs
Normal file
18
mcs/tests/gtest-autoproperty-17.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
class MainClass
|
||||
{
|
||||
abstract public class Bar
|
||||
{
|
||||
abstract public bool Condition { get; }
|
||||
}
|
||||
|
||||
class Baz: Bar
|
||||
{
|
||||
public override bool Condition { get; } = true;
|
||||
}
|
||||
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
}
|
||||
}
|
33
mcs/tests/gtest-autoproperty-18.cs
Normal file
33
mcs/tests/gtest-autoproperty-18.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
|
||||
public class A
|
||||
{
|
||||
public int Type { get; }
|
||||
|
||||
public A ()
|
||||
{
|
||||
Type = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public class B
|
||||
{
|
||||
static int Type { get; }
|
||||
|
||||
static B ()
|
||||
{
|
||||
Type = 1;
|
||||
}
|
||||
|
||||
static int Main ()
|
||||
{
|
||||
if (Type != 1)
|
||||
return 1;
|
||||
|
||||
var a = new A ();
|
||||
if (a.Type != 2)
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
23
mcs/tests/gtest-autoproperty-19.cs
Normal file
23
mcs/tests/gtest-autoproperty-19.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
abstract class Node
|
||||
{
|
||||
public virtual int Next { get; }
|
||||
}
|
||||
|
||||
class NodeLinked : Node
|
||||
{
|
||||
public NodeLinked (int next)
|
||||
{
|
||||
this.Next = next;
|
||||
}
|
||||
|
||||
public override int Next { get; }
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
var nl = new NodeLinked (5);
|
||||
if (nl.Next != 5)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -210,14 +210,6 @@ struct MyTypeImplicitOnly
|
||||
}
|
||||
}
|
||||
|
||||
struct StructWithUserConstructor
|
||||
{
|
||||
public StructWithUserConstructor ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class MemberAccessData
|
||||
{
|
||||
public bool BoolValue;
|
||||
@@ -2210,10 +2202,6 @@ class Tester
|
||||
Expression<Func<DateTime>> e = () => new DateTime ();
|
||||
AssertNodeType (e, ExpressionType.New);
|
||||
Assert (null, ((NewExpression)e.Body).Constructor, "default ctor");
|
||||
|
||||
Expression<Func<StructWithUserConstructor>> e2 = () => new StructWithUserConstructor ();
|
||||
AssertNodeType (e2, ExpressionType.New);
|
||||
Assert ("Void .ctor()", ((NewExpression)e2.Body).Constructor.ToString (), "user ctor");
|
||||
}
|
||||
|
||||
void NotTest ()
|
||||
|
36
mcs/tests/gtest-initialize-14.cs
Normal file
36
mcs/tests/gtest-initialize-14.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
struct S
|
||||
{
|
||||
public int X, Y;
|
||||
}
|
||||
|
||||
class X
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
var rect = new S {
|
||||
X = 1,
|
||||
Y = 2,
|
||||
};
|
||||
|
||||
if (rect.X != 1)
|
||||
return 1;
|
||||
|
||||
if (rect.Y != 2)
|
||||
return 2;
|
||||
|
||||
rect = new S {
|
||||
X = rect.X,
|
||||
Y = rect.Y,
|
||||
};
|
||||
|
||||
if (rect.X != 1)
|
||||
return 3;
|
||||
|
||||
if (rect.Y != 2)
|
||||
return 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -59,20 +59,30 @@ public class Program
|
||||
|
||||
static int Test_6 (params object[] o)
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int Test_6 (int i = 1, params object[] a)
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Test_7 (bool b, params object[] o)
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int Test_7 (bool b, int i = 1, params object[] a)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Test_8 (Type t, bool b = false, int x = 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Test_8 (Type t, params int[] x)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -100,6 +110,9 @@ public class Program
|
||||
if (Test_7 (false) != 0)
|
||||
return 7;
|
||||
|
||||
if (Test_8 (typeof (bool)) != 0)
|
||||
return 8;
|
||||
|
||||
Console.WriteLine ("ok");
|
||||
return 0;
|
||||
}
|
||||
|
@@ -4,12 +4,12 @@ using System;
|
||||
|
||||
namespace Bla.Blub
|
||||
{
|
||||
|
||||
class Fo‿o
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
public static void Main ()
|
||||
{
|
||||
Console.WriteLine("bla");
|
||||
string \u2161y = "";
|
||||
string y\u2161 = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,13 +25,12 @@ namespace System
|
||||
public struct UInt64 {}
|
||||
public struct IntPtr {}
|
||||
public struct UIntPtr {}
|
||||
public struct Decimal { }
|
||||
public class String { }
|
||||
public class Delegate {}
|
||||
public class MulticastDelegate {}
|
||||
public class Array {}
|
||||
public class Exception {}
|
||||
public class Type {}
|
||||
public partial class Type {}
|
||||
public class ValueType {}
|
||||
public class Enum {}
|
||||
public class Attribute {}
|
||||
@@ -42,6 +41,43 @@ namespace System
|
||||
public struct RuntimeFieldHandle {}
|
||||
|
||||
public interface IDisposable {}
|
||||
|
||||
public struct Decimal {
|
||||
|
||||
private int flags;
|
||||
|
||||
public Decimal(int[] bits) {
|
||||
flags = 0;
|
||||
SetBits(bits);
|
||||
}
|
||||
|
||||
public Decimal (int i)
|
||||
{
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
private void SetBits(int[] bits) {
|
||||
}
|
||||
}
|
||||
|
||||
partial class Type
|
||||
{
|
||||
public static bool operator == (Type left, Type right)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool operator != (Type left, Type right)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Foo ()
|
||||
{
|
||||
Decimal d = 0;
|
||||
var d2 = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace System.Runtime.InteropServices
|
||||
@@ -60,4 +96,3 @@ namespace System.Reflection
|
||||
{
|
||||
public class DefaultMemberAttribute {}
|
||||
}
|
||||
|
||||
|
@@ -1,76 +0,0 @@
|
||||
// Compiler options: -langversion:experimental
|
||||
using System;
|
||||
|
||||
struct S1
|
||||
{
|
||||
public readonly int Value;
|
||||
|
||||
public S1 ()
|
||||
{
|
||||
Value = 17;
|
||||
}
|
||||
}
|
||||
|
||||
struct S2
|
||||
{
|
||||
public readonly int Value = 23;
|
||||
}
|
||||
|
||||
struct S3
|
||||
{
|
||||
public readonly int Value = 11;
|
||||
|
||||
public S3 ()
|
||||
{
|
||||
Value = 5;
|
||||
}
|
||||
}
|
||||
|
||||
struct S4
|
||||
{
|
||||
public readonly int Value = 11;
|
||||
|
||||
public S4 (int v)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
struct S5
|
||||
{
|
||||
public readonly int Value = 7;
|
||||
|
||||
public S5 (int v)
|
||||
: this ()
|
||||
{
|
||||
this.Value += v;
|
||||
}
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
static int Main ()
|
||||
{
|
||||
var s = new S1 ();
|
||||
if (s.Value != 17)
|
||||
return 1;
|
||||
|
||||
var s2 = new S2 ();
|
||||
if (s2.Value != 23)
|
||||
return 2;
|
||||
|
||||
var s3 = new S3 ();
|
||||
if (s3.Value != 5)
|
||||
return 3;
|
||||
|
||||
var s4 = new S4 (5);
|
||||
if (s4.Value != 11)
|
||||
return 4;
|
||||
|
||||
var s5 = new S5 (2);
|
||||
if (s5.Value != 9)
|
||||
return 5;
|
||||
|
||||
Console.WriteLine ("ok");
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -1,6 +1,9 @@
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
[HostProtection]
|
||||
delegate void D ();
|
||||
|
||||
[HostProtection]
|
||||
class X
|
||||
{
|
||||
|
26
mcs/tests/test-919.cs
Normal file
26
mcs/tests/test-919.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
// Compiler options: -unsafe
|
||||
|
||||
class Test
|
||||
{
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
string s = "hello, world!";
|
||||
Outer (s);
|
||||
}
|
||||
|
||||
static void Outer (string s)
|
||||
{
|
||||
unsafe {
|
||||
fixed (char* sp = s) {
|
||||
char* p = sp;
|
||||
Inner (ref p, sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static unsafe void Inner (ref char* p, char* sp)
|
||||
{
|
||||
++sp;
|
||||
p = sp;
|
||||
}
|
||||
}
|
18
mcs/tests/test-921-lib.cs
Normal file
18
mcs/tests/test-921-lib.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Compiler options: -t:library
|
||||
|
||||
namespace Reference
|
||||
{
|
||||
public interface IB
|
||||
{
|
||||
}
|
||||
|
||||
public interface IA : IHide
|
||||
{
|
||||
new IB Equals { get; }
|
||||
}
|
||||
|
||||
public interface IHide
|
||||
{
|
||||
bool Equals(object o);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user