Imported Upstream version 5.10.0.78

Former-commit-id: 46737382176d7b811604042c613d5df6eef74f33
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-31 19:21:06 +00:00
parent b7cd5de421
commit 6db692b74b
55 changed files with 740 additions and 362 deletions

127
mcs/tests/test-async-94.cs Normal file
View File

@ -0,0 +1,127 @@
using System;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
[AsyncMethodBuilder (typeof(MyTaskMethodBuilder<>))]
class MyTask<T>
{
}
[AsyncMethodBuilder (typeof(MyTaskMethodBuilder))]
class MyTask
{
}
class MyTaskMethodBuilder
{
public static MyTaskMethodBuilder Create()
{
return null;
}
public MyTask Task {
get {
return null;
}
}
public void SetException (Exception exception)
{
}
public void SetResult ()
{
}
public void AwaitOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
{
}
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
{
}
public void Start<TStateMachine> (ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
{
}
public void SetStateMachine (IAsyncStateMachine stateMachine)
{
}
}
class MyTaskMethodBuilder<T>
{
public static MyTaskMethodBuilder<T> Create()
{
return null;
}
public MyTask<T> Task {
get {
return null;
}
}
public void SetException (Exception exception)
{
}
public void SetResult (T result)
{
}
public void AwaitOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
{
}
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
{
}
public void Start<TStateMachine> (ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
{
}
public void SetStateMachine (IAsyncStateMachine stateMachine)
{
}
}
class X
{
public async MyTask Test ()
{
await Task.Delay (1);
}
public async MyTask<int> Test2 ()
{
await Task.Delay (1);
return 2;
}
public async ValueTask<string> Test3 ()
{
await Task.Delay (1);
return "as";
}
public static void Main ()
{
var x = new X ();
var r1 = x.Test3 ().Result;
}
}