Skip to content

Commit 2e08bb9

Browse files
committed
Revise based on C# LDM changes to model
1 parent e72399f commit 2e08bb9

File tree

7 files changed

+12
-70
lines changed

7 files changed

+12
-70
lines changed

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@
640640
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncIteratorMethodBuilder.cs" />
641641
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs" />
642642
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncMethodBuilderAttribute.cs" />
643-
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncMethodBuilderOverrideAttribute.cs" />
644643
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncMethodBuilderCore.cs" />
645644
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncStateMachineAttribute.cs" />
646645
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\AsyncTaskMethodBuilder.cs" />

src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderAttribute.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ namespace System.Runtime.CompilerServices
55
{
66
/// <summary>
77
/// Indicates the type of the async method builder that should be used by a language compiler to
8-
/// build the attributed type when used as the return type of an async method.
8+
/// build the attributed async method or to build the attributed type when used as the return type
9+
/// of an async method.
910
/// </summary>
10-
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)]
11+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
1112
public sealed class AsyncMethodBuilderAttribute : Attribute
1213
{
1314
/// <summary>Initializes the <see cref="AsyncMethodBuilderAttribute"/>.</summary>

src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderOverrideAttribute.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/libraries/System.Runtime/ref/System.Runtime.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9114,18 +9114,12 @@ public sealed partial class AsyncIteratorStateMachineAttribute : System.Runtime.
91149114
{
91159115
public AsyncIteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
91169116
}
9117-
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
9117+
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
91189118
public sealed partial class AsyncMethodBuilderAttribute : System.Attribute
91199119
{
91209120
public AsyncMethodBuilderAttribute(System.Type builderType) { }
91219121
public System.Type BuilderType { get { throw null; } }
91229122
}
9123-
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Property | System.AttributeTargets.Module, Inherited = false, AllowMultiple = true)]
9124-
public sealed partial class AsyncMethodBuilderOverrideAttribute : System.Attribute
9125-
{
9126-
public AsyncMethodBuilderOverrideAttribute(System.Type builderType) { }
9127-
public System.Type BuilderType { get { throw null; } }
9128-
}
91299123
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
91309124
public sealed partial class AsyncStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
91319125
{

src/libraries/System.Threading.Tasks.Extensions/tests/AsyncMethodBuilderOverrideAttributeTests.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/libraries/System.Threading.Tasks.Extensions/tests/PoolingAsyncValueTaskMethodBuilderTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public static async Task NonGeneric_UsedWithAsyncMethod_CompletesSuccessfully(in
367367
await ValueTaskReturningAsyncMethod(84, result);
368368
Assert.Equal(84 + yields, result.Value);
369369

370-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
370+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
371371
async ValueTask ValueTaskReturningAsyncMethod(int result, StrongBox<int> output)
372372
{
373373
for (int i = 0; i < yields; i++)
@@ -390,7 +390,7 @@ public static async Task Generic_UsedWithAsyncMethod_CompletesSuccessfully(int y
390390
Assert.Equal(42 + yields, await ValueTaskReturningAsyncMethod(42));
391391
Assert.Equal(84 + yields, await ValueTaskReturningAsyncMethod(84));
392392

393-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
393+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
394394
async ValueTask<int> ValueTaskReturningAsyncMethod(int result)
395395
{
396396
for (int i = 0; i < yields; i++)
@@ -412,7 +412,7 @@ public static async Task AwaitTasksAndValueTasks_InTaskAndValueTaskMethods()
412412
Assert.Equal(18, await ValueTaskInt32ReturningMethod());
413413
}
414414

415-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
415+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
416416
async ValueTask ValueTaskReturningMethod()
417417
{
418418
for (int i = 0; i < 3; i++)
@@ -440,7 +440,7 @@ async ValueTask ValueTaskReturningMethod()
440440
}
441441
}
442442

443-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
443+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
444444
async ValueTask<int> ValueTaskInt32ReturningMethod()
445445
{
446446
for (int i = 0; i < 3; i++)
@@ -480,7 +480,7 @@ await Task.WhenAll(Enumerable.Range(0, Environment.ProcessorCount).Select(async
480480
{
481481
await ValueTaskAsync();
482482

483-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
483+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
484484
static async ValueTask ValueTaskAsync()
485485
{
486486
await Task.Delay(1);
@@ -499,7 +499,7 @@ await Task.WhenAll(Enumerable.Range(0, Environment.ProcessorCount).Select(async
499499
{
500500
Assert.Equal(42 + i, await ValueTaskAsync(i));
501501

502-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
502+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
503503
static async ValueTask<int> ValueTaskAsync(int i)
504504
{
505505
await Task.Delay(1);
@@ -549,14 +549,14 @@ public void PoolingAsyncValueTasksBuilder_ObjectsPooled(string limitEnvVar)
549549
Assert.InRange(boxes.Distinct().Count(), 1, boxes.Count - 1);
550550
}, new RemoteInvokeOptions() { StartInfo = psi }).Dispose();
551551

552-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
552+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<int>))]
553553
static async ValueTask<int> ComputeAsync(int input, ConcurrentQueue<object> boxes)
554554
{
555555
await RecursiveValueTaskAsync(3, boxes);
556556
return input * 2;
557557
}
558558

559-
[AsyncMethodBuilderOverride(typeof(PoolingAsyncValueTaskMethodBuilder))]
559+
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
560560
static async ValueTask RecursiveValueTaskAsync(int depth, ConcurrentQueue<object> boxes)
561561
{
562562
boxes.Enqueue(await GetStateMachineData.FetchAsync());

src/libraries/System.Threading.Tasks.Extensions/tests/System.Threading.Tasks.Extensions.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<Compile Include="AsyncMethodBuilderAttributeTests.cs" />
9-
<Compile Include="AsyncMethodBuilderOverrideAttributeTests.cs" />
109
<Compile Include="AsyncValueTaskMethodBuilderTests.cs" />
1110
<Compile Include="ManualResetValueTaskSourceTests.cs" />
1211
<Compile Include="PoolingAsyncValueTaskMethodBuilderTests.cs" />

0 commit comments

Comments
 (0)