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

@ -1,8 +1,8 @@
// Compiler options: -langversion:future
using System;
using System.Threading.Tasks;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
interface IFoo
{
@ -25,12 +25,28 @@ struct S : IFoo
}
}
struct S2 : IEnumerable
{
public List<int> Values;
public void Add (int x)
{
if (Values == null)
Values = new List<int> ();
Values.Add(x);
}
public IEnumerator GetEnumerator()
{
return Values as IEnumerator;
}
}
class Tester
{
async Task<T> NewInitTestGen<T> () where T : struct, IFoo
{
int value = 9;
var s = new T () {
Value = await Task.Factory.StartNew (() => 13).ConfigureAwait (false)
};
@ -40,6 +56,16 @@ class Tester
return s;
}
static async Task<int> NewInitCol ()
{
var s = new S2 {
await Task.FromResult (1),
await Task.Factory.StartNew (() => 2)
};
return s.Values [0] + s.Values [1];
}
public static int Main ()
{
@ -51,6 +77,10 @@ class Tester
if (t.Result.Value != 13)
return 2;
var v = NewInitCol ().Result;
if (v != 3)
return 3;
return 0;
}