You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
@@ -207,11 +207,14 @@ class Tester : DynamicObjectMock
|
||||
}
|
||||
}
|
||||
|
||||
static FieldInfo flags = typeof (CSharpArgumentInfo).GetField ("flags", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
static PropertyInfo flags = typeof (CSharpArgumentInfo).GetProperty ("Flags", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
static void AssertArgument (CallSiteBinder obj, CSharpArgumentInfo[] expected, string name)
|
||||
{
|
||||
var ai = obj.GetType ().GetField ("argumentInfo", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
var ai = obj.GetType ().GetField ("_argumentInfo", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (ai == null)
|
||||
throw new ApplicationException ("Could not find 'argumentInfo' private field on " + obj.GetType ());
|
||||
|
||||
IList<CSharpArgumentInfo> values = (IList<CSharpArgumentInfo>) ai.GetValue (obj);
|
||||
if (values.Count != expected.Length)
|
||||
throw new ApplicationException (name + ": Array length does not match " + values.Count + " != " + expected.Length);
|
||||
|
@@ -66,7 +66,7 @@ public class Test
|
||||
|
||||
if (Disposable.Counter != 1)
|
||||
return false;
|
||||
|
||||
/*
|
||||
try {
|
||||
using (dynamic u = new Disposable ()) {
|
||||
u.VV ();
|
||||
@@ -79,7 +79,7 @@ public class Test
|
||||
using (dynamic u = new Disposable ()) {
|
||||
u.Test ();
|
||||
}
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -40,6 +40,7 @@ public class Test
|
||||
a[4] ^= b;
|
||||
|
||||
dynamic d = 1;
|
||||
/*
|
||||
b = byte.MaxValue;
|
||||
try {
|
||||
checked {
|
||||
@@ -50,7 +51,7 @@ public class Test
|
||||
}
|
||||
|
||||
b += d;
|
||||
|
||||
*/
|
||||
try {
|
||||
checked {
|
||||
a.Byte += 100;
|
||||
|
@@ -23,7 +23,7 @@ class Tester
|
||||
() => {
|
||||
dynamic d = 1;
|
||||
d ();
|
||||
}, "Cannot invoke a non-delegate type `int'");
|
||||
}, "Cannot invoke a non-delegate type");
|
||||
}
|
||||
|
||||
void Using_1 ()
|
||||
@@ -31,7 +31,7 @@ class Tester
|
||||
AssertError (
|
||||
() => {
|
||||
using (dynamic d = 1) { }
|
||||
}, "Cannot implicitly convert type `int' to `System.IDisposable'");
|
||||
}, "Cannot implicitly convert type 'int' to 'System.IDisposable'");
|
||||
}
|
||||
|
||||
void Unsafe_1 ()
|
||||
@@ -39,7 +39,7 @@ class Tester
|
||||
dynamic d = 1;
|
||||
AssertError (
|
||||
() => Helper.Foo (d),
|
||||
"Pointers and fixed size buffers cannot be used in a dynamic context");
|
||||
"Dynamic calls cannot be used in conjunction with pointers");
|
||||
}
|
||||
|
||||
void NullableConversion ()
|
||||
@@ -50,7 +50,7 @@ class Tester
|
||||
dynamic b = false;
|
||||
byte? b2 = null;
|
||||
b &= b2;
|
||||
}, "Operator `&=' cannot be applied to operands of type `bool' and `byte?'");
|
||||
}, "Operator '&=' cannot be applied to operands of type 'bool' and 'byte?'");
|
||||
}
|
||||
|
||||
#pragma warning restore 169
|
||||
|
@@ -34,7 +34,7 @@ public class Test
|
||||
d.Foo ();
|
||||
return 1;
|
||||
} catch (RuntimeBinderException e) {
|
||||
if (e.Message != "`A.N.Foo()' is inaccessible due to its protection level")
|
||||
if (e.Message != "'object' does not contain a definition for 'Foo'")
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Test
|
||||
var x = d.Property;
|
||||
return 3;
|
||||
} catch (RuntimeBinderException e) {
|
||||
if (e.Message != "`A.N.Property.get' is inaccessible due to its protection level")
|
||||
if (e.Message != "'object' does not contain a definition for 'Property'")
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class Test
|
||||
var x = d [4];
|
||||
return 5;
|
||||
} catch (RuntimeBinderException e) {
|
||||
if (e.Message != "`A.N.this[int]' is inaccessible due to its protection level")
|
||||
if (e.Message != "Cannot apply indexing with [] to an expression of type 'object'")
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ public class Test
|
||||
try {
|
||||
getter.Target (getter, new C ());
|
||||
} catch (RuntimeBinderException e) {
|
||||
if (e.Message == "`C' does not contain a definition for `n'")
|
||||
if (e.Message == "'C' does not contain a definition for 'n'")
|
||||
return 0;
|
||||
|
||||
return 2;
|
||||
|
@@ -16,7 +16,7 @@ public class Test
|
||||
d.Value = (object)"value";
|
||||
return 1;
|
||||
} catch (RuntimeBinderException e) {
|
||||
if (e.Message != "Cannot implicitly convert type `object' to `string'. An explicit conversion exists (are you missing a cast?)")
|
||||
if (e.Message != "Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)")
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
29
mcs/tests/gtest-644.cs
Normal file
29
mcs/tests/gtest-644.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
public struct MoneyValue
|
||||
{
|
||||
private readonly decimal _amount;
|
||||
|
||||
public MoneyValue (decimal amount)
|
||||
{
|
||||
_amount = amount;
|
||||
}
|
||||
|
||||
public static implicit operator decimal (MoneyValue moneyValue)
|
||||
{
|
||||
return moneyValue._amount;
|
||||
}
|
||||
}
|
||||
|
||||
public class Program
|
||||
{
|
||||
static void Main ()
|
||||
{
|
||||
var nullMoneyValue = (MoneyValue?) null;
|
||||
var moneyValue = new MoneyValue (123);
|
||||
|
||||
var crashApplication = nullMoneyValue < moneyValue;
|
||||
|
||||
Console.WriteLine("All OK");
|
||||
}
|
||||
}
|
10
mcs/tests/gtest-645-lib.cs
Normal file
10
mcs/tests/gtest-645-lib.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
// Compiler options: -target:library
|
||||
|
||||
namespace SeparateAssembly
|
||||
{
|
||||
public interface IGenericAction<T1, T2>
|
||||
{
|
||||
void AddAction(IGenericAction<T1, T2> action);
|
||||
void AddAction(IGenericAction<T2, T1> action);
|
||||
}
|
||||
}
|
17
mcs/tests/gtest-645.cs
Normal file
17
mcs/tests/gtest-645.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
// Compiler options: -r:gtest-645-lib.dll
|
||||
|
||||
using System;
|
||||
using SeparateAssembly;
|
||||
|
||||
class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
}
|
||||
|
||||
public static void AddChildButton<T1, T2>(IGenericAction<T1, T2> action)
|
||||
{
|
||||
IGenericAction<T2, T1> childAction = null;
|
||||
action.AddAction (childAction);
|
||||
}
|
||||
}
|
30
mcs/tests/gtest-autoproperty-22.cs
Normal file
30
mcs/tests/gtest-autoproperty-22.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
class MainClass
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
Child test = new Child();
|
||||
}
|
||||
}
|
||||
|
||||
class Parent
|
||||
{
|
||||
protected virtual string Property { get; }
|
||||
}
|
||||
|
||||
class Child : Parent
|
||||
{
|
||||
protected override string Property { get; }
|
||||
|
||||
public Child ()
|
||||
{
|
||||
new AnotherClass{ field = Property = "success" };
|
||||
Console.WriteLine(Property);
|
||||
}
|
||||
}
|
||||
|
||||
class AnotherClass
|
||||
{
|
||||
public string field;
|
||||
}
|
39
mcs/tests/test-942.cs
Normal file
39
mcs/tests/test-942.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ConditionalAttributeTesting
|
||||
{
|
||||
class MainClass
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
return HelloWorld ();
|
||||
}
|
||||
|
||||
[Some ("Test")]
|
||||
public static int HelloWorld ()
|
||||
{
|
||||
var methodInfo = MethodBase.GetCurrentMethod ();
|
||||
SomeAttribute someAttribute = Attribute.GetCustomAttribute (methodInfo, typeof (SomeAttribute)) as SomeAttribute;
|
||||
if (someAttribute != null) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage (AttributeTargets.All)]
|
||||
[Conditional ("NOT_DEFINED")]
|
||||
public abstract class BaseAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
public class SomeAttribute : BaseAttribute
|
||||
{
|
||||
public SomeAttribute (string someText)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -41,6 +41,10 @@ class X {
|
||||
return 3;
|
||||
if (Test.A == Test.B)
|
||||
return 4;
|
||||
|
||||
const A e2 = 3 - A.b;
|
||||
if (e2 != A.a)
|
||||
return 5;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
31
mcs/tests/test-anon-178.cs
Normal file
31
mcs/tests/test-anon-178.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
public abstract class BaseClass<T>
|
||||
{
|
||||
}
|
||||
|
||||
public class DerivedClass : BaseClass<int>
|
||||
{
|
||||
}
|
||||
|
||||
public abstract class CA
|
||||
{
|
||||
[Obsolete]
|
||||
public virtual void Foo<T, U> (U args) where T : BaseClass<U>, new()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class CB : CA
|
||||
{
|
||||
public CB ()
|
||||
{
|
||||
int x = 4;
|
||||
Action<int> pp = r => base.Foo<DerivedClass, int> (x);
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
new CB ();
|
||||
}
|
||||
}
|
35
mcs/tests/test-async-90.cs
Normal file
35
mcs/tests/test-async-90.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
static class Y
|
||||
{
|
||||
public static string ExCall (this X x)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class X
|
||||
{
|
||||
static X Test (object o)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
X Prop { get; set;}
|
||||
|
||||
X Call ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
var x = new X ();
|
||||
x.Test ().Wait ();
|
||||
}
|
||||
|
||||
async Task Test ()
|
||||
{
|
||||
var x = X.Test (await Task.FromResult (1))?.Prop?.ExCall ();
|
||||
}
|
||||
}
|
38
mcs/tests/test-async-91.cs
Normal file
38
mcs/tests/test-async-91.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class C : IDisposable
|
||||
{
|
||||
public void Dispose ()
|
||||
{
|
||||
Console.WriteLine ("Disposed");
|
||||
TestClass.Passed++;
|
||||
}
|
||||
}
|
||||
|
||||
public class TestClass
|
||||
{
|
||||
public static int Passed;
|
||||
|
||||
public static async Task Test ()
|
||||
{
|
||||
using (var device_resource = new C ()) {
|
||||
try {
|
||||
Console.WriteLine ("aa");
|
||||
return;
|
||||
} finally {
|
||||
await Task.Delay (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int Main()
|
||||
{
|
||||
Test ().Wait ();
|
||||
if (Passed != 1)
|
||||
return 1;
|
||||
|
||||
Console.WriteLine ("PASSED");
|
||||
return 0;
|
||||
}
|
||||
}
|
22
mcs/tests/test-async-92.cs
Normal file
22
mcs/tests/test-async-92.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class A
|
||||
{
|
||||
public async Task<ValueType> Test1 (int input2)
|
||||
{
|
||||
return new ValueType (await Task.FromResult (12345));
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
var a = new A ();
|
||||
a.Test1 (1).Wait ();
|
||||
}
|
||||
}
|
||||
|
||||
public struct ValueType
|
||||
{
|
||||
public ValueType (int field2)
|
||||
{
|
||||
}
|
||||
}
|
44
mcs/tests/test-async-93.cs
Normal file
44
mcs/tests/test-async-93.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Test
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
var t = new Test ();
|
||||
t.Entry().Wait();
|
||||
if (t.caughtCounter != 1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int caughtCounter;
|
||||
|
||||
async Task Entry()
|
||||
{
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
try {
|
||||
var result = Func(i);
|
||||
Console.WriteLine($"{i} result {result}");
|
||||
} catch (Exception e) {
|
||||
await Nothing();
|
||||
Console.WriteLine($"{i} caught");
|
||||
++caughtCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Func(int i)
|
||||
{
|
||||
if (i == 0) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
async Task Nothing()
|
||||
{
|
||||
}
|
||||
}
|
20
mcs/tests/test-expression-bodied-03.cs
Normal file
20
mcs/tests/test-expression-bodied-03.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
class X
|
||||
{
|
||||
int v;
|
||||
|
||||
public int Prop {
|
||||
get => 1;
|
||||
set => v = value;
|
||||
}
|
||||
|
||||
public event Action A {
|
||||
add => v = 1;
|
||||
remove => v = 2;
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
}
|
||||
}
|
19
mcs/tests/test-null-operator-24.cs
Normal file
19
mcs/tests/test-null-operator-24.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
class X
|
||||
{
|
||||
public int Field { get; set; }
|
||||
|
||||
public int F3 { get; set; }
|
||||
}
|
||||
|
||||
class App
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
string s = null;
|
||||
var x = new X {
|
||||
Field = s?.ToString () == null ? 1 : 2
|
||||
}.F3;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user