-// Compiler options: -langversion:future
-
using System;
using System.Threading.Tasks;
using System.Threading;
using System.Reflection;
using System.Linq;
+using System.Runtime.CompilerServices;
struct S
{
public int Value;
+ public S2 s2;
public S (int a1, string a2)
{
Value = a1;
+ s2 = new S2 ();
}
public void SetValue (int value)
}
}
+struct S2
+{
+ public int Value;
+}
+
enum E
{
E_1 = 1
return 0;
}
+ async Task<bool> ArrayAccessTest_10 ()
+ {
+ var b = new bool [1] { true };
+
+ var r = b [await Task.Factory.StartNew (() => 0)];
+ return r;
+ }
+
+ async Task<bool> ArrayAccessTest_11 ()
+ {
+ var a = new S [1];
+ a [await Task.Factory.StartNew (() => 0)].s2.Value += 5;
+ return a [await Task.Factory.StartNew(() => 0)].s2.Value == 5;
+ }
+
async Task<int> AssignTest_1 ()
{
field_int = await Task.Factory.StartNew (() => 0);
return 0;
}
+ async Task<int> BinaryTest_5 ()
+ {
+ var r1 = await Task.FromResult (1) == 9;
+ if (r1)
+ return 1;
+
+ var r2 = 1 == await Task.FromResult (1);
+ if (!r2)
+ return 2;
+
+ return 0;
+ }
+
+ async Task<bool> BinaryTest_6 ()
+ {
+ var t = Task.Delay (1);
+ if (t == await Task.WhenAny(new [] { t }))
+ return true;
+
+ return false;
+ }
+
async Task<int> CallTest_1 ()
{
return Call (
async Task<int> ConditionalTest_1 ()
{
- // TODO: problem with Resumable point setup when the expression never emitted
- //bool b = true;
- //return true ? await Task.Factory.StartNew (() => 0) : await Task.Factory.StartNew (() => 1);
- return 0;
+ return true ? await Task.Factory.StartNew (() => 0) : await Task.Factory.StartNew (() => 1);
}
async Task<int> ConditionalTest_2 ()
var s = new S (await Task.Factory.StartNew (() => 77), await Task.Factory.StartNew (() => "b"));
return s.Value == 77;
}
+
+ async Task<int> NewDelegate_1 ()
+ {
+ var f = new Func<int> (await NewDelegate_1_0 ());
+ return f ();
+ }
+
+ static async Task<Func<int>> NewDelegate_1_0 ()
+ {
+ await Task.Factory.StartNew (() => { });
+ return () => 0;
+ }
async Task<int> NewInitTest_1 ()
{
return a.Length == 13;
}
+ async Task<bool> NewArrayInitTest_7 ()
+ {
+ var res = new [] { "a", new [] { "1", await Task.FromResult ("2") } [1], "b" };
+ return res [1] == "2";
+ }
+
async Task<bool> PropertyTest_1 ()
{
PropertyInt = await Task.Factory.StartNew (() => 6);
public static int Main ()
{
var tests = from test in typeof (Tester).GetMethods (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)
- where test.GetParameters ().Length == 0
+ where test.GetParameters ().Length == 0 && !test.IsDefined (typeof (CompilerGeneratedAttribute), false)
orderby test.Name
select RunTest (test);