Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9bb6ef0d
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9bb6ef0d
编写于
1月 16, 2018
作者:
V
vsadov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed tests
上级
ec74d055
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
155 addition
and
155 deletion
+155
-155
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncSpillTests.cs
...pilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncSpillTests.cs
+143
-152
src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs
...Sharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs
+12
-3
未找到文件。
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncSpillTests.cs
浏览文件 @
9bb6ef0d
...
...
@@ -599,7 +599,7 @@ public static async Task<int> F(int[] array)
v
.
VerifyIL
(
"Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 2
85 (0x11d
)
// Code size 2
73 (0x111
)
.maxstack 5
.locals init (int V_0,
int V_1,
...
...
@@ -634,15 +634,15 @@ .maxstack 5
IL_0029: ldarg.0
IL_002a: ldarg.0
IL_002b: ldfld ""int[] Test.<F>d__2.array""
IL_0030: stfld ""int[] Test.<F>d__2.<>s__
5
""
IL_0030: stfld ""int[] Test.<F>d__2.<>s__
4
""
IL_0035: ldarg.0
IL_0036: ldfld ""int[] Test.<F>d__2.<>s__
5
""
IL_0036: ldfld ""int[] Test.<F>d__2.<>s__
4
""
IL_003b: ldc.i4.3
IL_003c: ldelem.i4
IL_003d: pop
IL_003e: ldarg.0
IL_003f: ldarg.0
IL_0040: ldfld ""int[] Test.<F>d__2.<>s__
5
""
IL_0040: ldfld ""int[] Test.<F>d__2.<>s__
4
""
IL_0045: ldc.i4.3
IL_0046: ldelem.i4
IL_0047: stfld ""int Test.<F>d__2.<>s__2""
...
...
@@ -668,7 +668,7 @@ .maxstack 5
IL_007b: ldloca.s V_4
IL_007d: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0082: nop
IL_0083: leave IL_011
c
IL_0083: leave IL_011
0
>IL_0088: ldarg.0
IL_0089: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008e: stloc.3
...
...
@@ -685,55 +685,51 @@ .maxstack 5
IL_00a7: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00ac: stfld ""int Test.<F>d__2.<>s__3""
IL_00b1: ldarg.0
IL_00b2: ldarg.0
IL_00b3: ldfld ""int[] Test.<F>d__2.<>s__5""
IL_00b8: ldc.i4.3
IL_00b9: ldarg.0
IL_00ba: ldfld ""int Test.<F>d__2.<>s__2""
IL_00bf: ldarg.0
IL_00c0: ldfld ""int Test.<F>d__2.<>s__3""
IL_00c5: add
IL_00c6: dup
IL_00c7: stloc.2
IL_00c8: stelem.i4
IL_00c9: ldloc.2
IL_00ca: stfld ""int Test.<F>d__2.<>s__4""
IL_00cf: ldarg.0
IL_00d0: ldfld ""int Test.<F>d__2.<>s__1""
IL_00d5: ldarg.0
IL_00d6: ldfld ""int Test.<F>d__2.<>s__4""
IL_00db: ldc.i4.4
IL_00dc: call ""int Test.H(int, int, int)""
IL_00e1: pop
IL_00e2: ldarg.0
IL_00e3: ldnull
IL_00e4: stfld ""int[] Test.<F>d__2.<>s__5""
-IL_00e9: ldc.i4.1
IL_00ea: stloc.1
IL_00eb: leave.s IL_0107
IL_00b2: ldfld ""int Test.<F>d__2.<>s__1""
IL_00b7: ldarg.0
IL_00b8: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_00bd: ldc.i4.3
IL_00be: ldarg.0
IL_00bf: ldfld ""int Test.<F>d__2.<>s__2""
IL_00c4: ldarg.0
IL_00c5: ldfld ""int Test.<F>d__2.<>s__3""
IL_00ca: add
IL_00cb: dup
IL_00cc: stloc.2
IL_00cd: stelem.i4
IL_00ce: ldloc.2
IL_00cf: ldc.i4.4
IL_00d0: call ""int Test.H(int, int, int)""
IL_00d5: pop
IL_00d6: ldarg.0
IL_00d7: ldnull
IL_00d8: stfld ""int[] Test.<F>d__2.<>s__4""
-IL_00dd: ldc.i4.1
IL_00de: stloc.1
IL_00df: leave.s IL_00fb
}
catch System.Exception
{
~IL_00e
d
: stloc.s V_5
IL_00e
f
: ldarg.0
IL_00
f0
: ldc.i4.s -2
IL_00
f2
: stfld ""int Test.<F>d__2.<>1__state""
IL_00
f7
: ldarg.0
IL_00
f8
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00f
d
: ldloc.s V_5
IL_00f
f
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_0
104
: nop
IL_0
105: leave.s IL_011c
~IL_00e
1
: stloc.s V_5
IL_00e
3
: ldarg.0
IL_00
e4
: ldc.i4.s -2
IL_00
e6
: stfld ""int Test.<F>d__2.<>1__state""
IL_00
eb
: ldarg.0
IL_00
ec
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00f
1
: ldloc.s V_5
IL_00f
3
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_0
0f8
: nop
IL_0
0f9: leave.s IL_0110
}
-IL_0
107
: ldarg.0
IL_0
108
: ldc.i4.s -2
IL_0
10a
: stfld ""int Test.<F>d__2.<>1__state""
~IL_010
f
: ldarg.0
IL_01
10
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_01
15
: ldloc.1
IL_01
16
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_01
1b
: nop
IL_011
c
: ret
-IL_0
0fb
: ldarg.0
IL_0
0fc
: ldc.i4.s -2
IL_0
0fe
: stfld ""int Test.<F>d__2.<>1__state""
~IL_010
3
: ldarg.0
IL_01
04
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_01
09
: ldloc.1
IL_01
0a
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_01
0f
: nop
IL_011
0
: ret
}"
,
sequencePoints
:
"Test+<F>d__2.MoveNext"
);
}
...
...
@@ -766,22 +762,21 @@ public static async Task<int> F(int[] array)
v
.
VerifyIL
(
"Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 2
60 (0x104
)
.maxstack
4
// Code size 2
51 (0xfb
)
.maxstack
5
.locals init (int V_0,
int V_1,
int V_2,
int V_3,
int V_4,
System.Runtime.CompilerServices.TaskAwaiter<int> V_5,
System.Exception V_6)
System.Runtime.CompilerServices.TaskAwaiter<int> V_4,
System.Exception V_5)
~IL_0000: ldarg.0
IL_0001: ldfld ""int Test.<F>d__2.<>1__state""
IL_0006: stloc.0
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_00
82
IL_0008: brfalse.s IL_00
7d
-IL_000a: ldarg.0
IL_000b: ldarg.0
IL_000c: ldfld ""int[] Test.<F>d__2.array""
...
...
@@ -792,108 +787,105 @@ .maxstack 4
IL_0019: ldc.i4.2
IL_001a: add
IL_001b: dup
IL_001c: stloc.s V_4
IL_001e: stind.i4
IL_001f: ldloc.s V_4
IL_0021: stfld ""int Test.<F>d__2.<>7__wrap1""
IL_0026: ldarg.0
IL_0027: ldarg.0
IL_0028: ldfld ""int[] Test.<F>d__2.array""
IL_002d: stfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0032: ldarg.0
IL_0033: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0038: ldc.i4.3
IL_0039: ldelem.i4
IL_003a: pop
IL_003b: ldarg.0
IL_003c: ldarg.0
IL_003d: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0042: ldc.i4.3
IL_0043: ldelem.i4
IL_0044: stfld ""int Test.<F>d__2.<>7__wrap2""
IL_0049: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_004e: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0053: stloc.s V_5
~IL_0055: ldloca.s V_5
IL_0057: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005c: brtrue.s IL_009f
IL_005e: ldarg.0
IL_005f: ldc.i4.0
IL_0060: dup
IL_0061: stloc.0
IL_0062: stfld ""int Test.<F>d__2.<>1__state""
<IL_0067: ldarg.0
IL_0068: ldloc.s V_5
IL_006a: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_006f: ldarg.0
IL_0070: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0075: ldloca.s V_5
IL_0077: ldarg.0
IL_0078: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_007d: leave IL_0103
>IL_0082: ldarg.0
IL_0083: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0088: stloc.s V_5
IL_008a: ldarg.0
IL_008b: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0090: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0096: ldarg.0
IL_0097: ldc.i4.m1
IL_0098: dup
IL_0099: stloc.0
IL_009a: stfld ""int Test.<F>d__2.<>1__state""
IL_009f: ldloca.s V_5
IL_00a1: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00a6: stloc.2
IL_00a7: ldarg.0
IL_00a8: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_00ad: ldc.i4.3
IL_00ae: ldarg.0
IL_00af: ldfld ""int Test.<F>d__2.<>7__wrap2""
IL_00b4: ldloc.2
IL_00b5: add
IL_00b6: dup
IL_00b7: stloc.s V_4
IL_001c: stloc.3
IL_001d: stind.i4
IL_001e: ldloc.3
IL_001f: stfld ""int Test.<F>d__2.<>7__wrap1""
IL_0024: ldarg.0
IL_0025: ldarg.0
IL_0026: ldfld ""int[] Test.<F>d__2.array""
IL_002b: stfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0030: ldarg.0
IL_0031: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0036: ldc.i4.3
IL_0037: ldelem.i4
IL_0038: pop
IL_0039: ldarg.0
IL_003a: ldarg.0
IL_003b: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_0040: ldc.i4.3
IL_0041: ldelem.i4
IL_0042: stfld ""int Test.<F>d__2.<>7__wrap2""
IL_0047: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_004c: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0051: stloc.s V_4
~IL_0053: ldloca.s V_4
IL_0055: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005a: brtrue.s IL_009a
IL_005c: ldarg.0
IL_005d: ldc.i4.0
IL_005e: dup
IL_005f: stloc.0
IL_0060: stfld ""int Test.<F>d__2.<>1__state""
<IL_0065: ldarg.0
IL_0066: ldloc.s V_4
IL_0068: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_006d: ldarg.0
IL_006e: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0073: ldloca.s V_4
IL_0075: ldarg.0
IL_0076: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_007b: leave.s IL_00fa
>IL_007d: ldarg.0
IL_007e: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0083: stloc.s V_4
IL_0085: ldarg.0
IL_0086: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008b: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0091: ldarg.0
IL_0092: ldc.i4.m1
IL_0093: dup
IL_0094: stloc.0
IL_0095: stfld ""int Test.<F>d__2.<>1__state""
IL_009a: ldloca.s V_4
IL_009c: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00a1: stloc.2
IL_00a2: ldarg.0
IL_00a3: ldfld ""int Test.<F>d__2.<>7__wrap1""
IL_00a8: ldarg.0
IL_00a9: ldfld ""int[] Test.<F>d__2.<>7__wrap3""
IL_00ae: ldc.i4.3
IL_00af: ldarg.0
IL_00b0: ldfld ""int Test.<F>d__2.<>7__wrap2""
IL_00b5: ldloc.2
IL_00b6: add
IL_00b7: dup
IL_00b8: stloc.3
IL_00b9: stelem.i4
IL_00ba: ldloc.s V_4
IL_00bc: stloc.3
IL_00bd: ldarg.0
IL_00be: ldfld ""int Test.<F>d__2.<>7__wrap1""
IL_00c3: ldloc.3
IL_00c4: ldc.i4.4
IL_00c5: call ""int Test.H(int, int, int)""
IL_00ca: pop
IL_00cb: ldarg.0
IL_00cc: ldnull
IL_00cd: stfld ""int[] Test.<F>d__2.<>7__wrap3""
-IL_00d2: ldc.i4.1
IL_00d3: stloc.1
IL_00d4: leave.s IL_00ef
IL_00ba: ldloc.3
IL_00bb: ldc.i4.4
IL_00bc: call ""int Test.H(int, int, int)""
IL_00c1: pop
IL_00c2: ldarg.0
IL_00c3: ldnull
IL_00c4: stfld ""int[] Test.<F>d__2.<>7__wrap3""
-IL_00c9: ldc.i4.1
IL_00ca: stloc.1
IL_00cb: leave.s IL_00e6
}
catch System.Exception
{
~IL_00
d6: stloc.s V_6
IL_00
d8
: ldarg.0
IL_00d
9
: ldc.i4.s -2
IL_00d
b
: stfld ""int Test.<F>d__2.<>1__state""
IL_00
e0
: ldarg.0
IL_00
e1
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00
e6: ldloc.s V_6
IL_00
e8
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00e
d: leave.s IL_0103
~IL_00
cd: stloc.s V_5
IL_00
cf
: ldarg.0
IL_00d
0
: ldc.i4.s -2
IL_00d
2
: stfld ""int Test.<F>d__2.<>1__state""
IL_00
d7
: ldarg.0
IL_00
d8
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00
dd: ldloc.s V_5
IL_00
df
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00e
4: leave.s IL_00fa
}
-IL_00e
f
: ldarg.0
IL_00
f0
: ldc.i4.s -2
IL_00
f2
: stfld ""int Test.<F>d__2.<>1__state""
~IL_00
f7
: ldarg.0
IL_00
f8
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00f
d
: ldloc.1
IL_00f
e
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_0
103
: ret
-IL_00e
6
: ldarg.0
IL_00
e7
: ldc.i4.s -2
IL_00
e9
: stfld ""int Test.<F>d__2.<>1__state""
~IL_00
ee
: ldarg.0
IL_00
ef
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00f
4
: ldloc.1
IL_00f
5
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_0
0fa
: ret
}"
,
sequencePoints
:
"Test+<F>d__2.MoveNext"
);
}
[
Fact
]
public
void
SpillSequencesInConditionalExpression1
()
{
...
...
@@ -981,9 +973,8 @@ public static async Task<int> F(int[] array)
"<>s__5"
,
"<>s__6"
,
"<>s__7"
,
"<>s__8"
,
"<>u__1"
,
"<>s__
9
"
"<>s__
8
"
},
module
.
GetFieldNames
(
"C.<F>d__3"
));
});
}
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturnsTests.cs
浏览文件 @
9bb6ef0d
...
...
@@ -1737,15 +1737,24 @@ void Write(ref int y)
{
Console.WriteLine(y);
}
void Write(ref int y, int z)
{
Console.WriteLine(z);
}
async Task TestMethod()
{
// this is OK. `ref` is not spilled.
Write(ref Save(await Task.FromResult(0)));
// ERROR. `ref` is spilled because it must survive until after the second `await.
Write(ref Save(await Task.FromResult(0)), await Task.FromResult(1));
}
}"
;
CreateCompilationWithMscorlib45
(
code
).
VerifyEmitDiagnostics
(
// (18,24): error CS8178: 'await' cannot be used in an expression containing a call to 'TestClass.Save(int)' because it returns by reference
// Write(ref Save(await Task.FromResult(0)));
Diagnostic
(
ErrorCode
.
ERR_RefReturningCallAndAwait
,
"await Task.FromResult(0)"
).
WithArguments
(
"TestClass.Save(int)"
).
WithLocation
(
18
,
24
));
// (26,51): error CS8178: 'await' cannot be used in an expression containing a call to 'TestClass.Save(int)' because it returns by reference
// Write(ref Save(await Task.FromResult(0)), await Task.FromResult(1));
Diagnostic
(
ErrorCode
.
ERR_RefReturningCallAndAwait
,
"await Task.FromResult(1)"
).
WithArguments
(
"TestClass.Save(int)"
).
WithLocation
(
26
,
51
)
);
}
[
Fact
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录