Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9ef6950a
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,发现更多精彩内容 >>
提交
9ef6950a
编写于
9月 20, 2017
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix a failing unit test and add CompilerTrait attribute for IOperation
上级
5940424d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
4 deletion
+19
-4
src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs
...Sharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs
+19
-4
未找到文件。
src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs
浏览文件 @
9ef6950a
...
@@ -83,6 +83,7 @@ public int aa
...
@@ -83,6 +83,7 @@ public int aa
Assert
.
Equal
(
info3
.
Type
,
info4
.
Type
);
Assert
.
Equal
(
info3
.
Type
,
info4
.
Type
);
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_Simple_OperationTree
()
public
void
AnonymousTypeSymbols_Simple_OperationTree
()
{
{
...
@@ -128,7 +129,7 @@ public int aa
...
@@ -128,7 +129,7 @@ public int aa
public static SSS CCC = new SSS();
public static SSS CCC = new SSS();
}
}
"
;
"
;
string
expectedOperationTree
=
@"
string
expectedOperationTree
=
@"
IBlockStatement (4 statements, 4 locals) (OperationKind.BlockStatement) (Syntax: '{ ... }')
IBlockStatement (4 statements, 4 locals) (OperationKind.BlockStatement) (Syntax: '{ ... }')
Locals: Local_1: System.Object v1
Locals: Local_1: System.Object v1
Local_2: System.Object v2
Local_2: System.Object v2
...
@@ -249,6 +250,7 @@ public int select
...
@@ -249,6 +250,7 @@ public int select
info1
.
Symbol
.
ToTestDisplayString
());
info1
.
Symbol
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_ContextualKeywordsInFields_OperationTree
()
public
void
AnonymousTypeSymbols_ContextualKeywordsInFields_OperationTree
()
{
{
...
@@ -277,7 +279,7 @@ public int select
...
@@ -277,7 +279,7 @@ public int select
public const string global = "" -=-= -"";
public const string global = "" -=-= -"";
}
}
"
;
"
;
string
expectedOperationTree
=
@"
string
expectedOperationTree
=
@"
IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>) (Syntax: 'new ... }')
IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>) (Syntax: 'new ... }')
Initializers(3):
Initializers(3):
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.String, Constant: ""var"") (Syntax: 'var = ""var""')
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.String, Constant: ""var"") (Syntax: 'var = ""var""')
...
@@ -328,6 +330,7 @@ void Main()
...
@@ -328,6 +330,7 @@ void Main()
Assert
.
Equal
(
"<anonymous type: D1 module>..ctor(D1 module)"
,
info0
.
Symbol
.
ToTestDisplayString
());
Assert
.
Equal
(
"<anonymous type: D1 module>..ctor(D1 module)"
,
info0
.
Symbol
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_DelegateMembers_OperationTree
()
public
void
AnonymousTypeSymbols_DelegateMembers_OperationTree
()
{
{
...
@@ -388,6 +391,7 @@ void Main()
...
@@ -388,6 +391,7 @@ void Main()
Assert
.
Equal
(
"System.Int32 System.Func<System.Int32, System.Int32>.Invoke(System.Int32 arg)"
,
info1
.
Symbol
.
ToTestDisplayString
());
Assert
.
Equal
(
"System.Int32 System.Func<System.Int32, System.Int32>.Invoke(System.Int32 arg)"
,
info1
.
Symbol
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_BaseAccessInMembers_OperationTree
()
public
void
AnonymousTypeSymbols_BaseAccessInMembers_OperationTree
()
{
{
...
@@ -433,6 +437,7 @@ class ClassA
...
@@ -433,6 +437,7 @@ class ClassA
Assert
.
Equal
(
"<anonymous type: System.Type F123>"
,
info0
.
Type
.
ToTestDisplayString
());
Assert
.
Equal
(
"<anonymous type: System.Type F123>"
,
info0
.
Type
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_InFieldInitializer_OperationTree
()
public
void
AnonymousTypeSymbols_InFieldInitializer_OperationTree
()
{
{
...
@@ -448,7 +453,7 @@ class ClassA
...
@@ -448,7 +453,7 @@ class ClassA
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Type) (Syntax: 'F123 = typeof(ClassA)')
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Type) (Syntax: 'F123 = typeof(ClassA)')
Left: IPropertyReferenceExpression: System.Type <anonymous type: System.Type F123>.F123 { get; } (Static) (OperationKind.PropertyReferenceExpression, Type: System.Type) (Syntax: 'F123')
Left: IPropertyReferenceExpression: System.Type <anonymous type: System.Type F123>.F123 { get; } (Static) (OperationKind.PropertyReferenceExpression, Type: System.Type) (Syntax: 'F123')
Instance Receiver: null
Instance Receiver: null
Right: ITypeOfExpression (OperationKind.
Non
e) (Syntax: 'typeof(ClassA)')
Right: ITypeOfExpression (OperationKind.
TypeOfExpression, Type: System.Typ
e) (Syntax: 'typeof(ClassA)')
TypeOperand: ClassA
TypeOperand: ClassA
"
;
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
@@ -477,6 +482,7 @@ static void Test1(int x)
...
@@ -477,6 +482,7 @@ static void Test1(int x)
Assert
.
Equal
(
"object.Equals(object)"
,
method
.
ToDisplayString
());
Assert
.
Equal
(
"object.Equals(object)"
,
method
.
ToDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_Equals_OperationTree
()
public
void
AnonymousTypeSymbols_Equals_OperationTree
()
{
{
...
@@ -661,6 +667,7 @@ void m()
...
@@ -661,6 +667,7 @@ void m()
Assert
.
Equal
(
"System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.y { get; }"
,
info2
.
Symbol
.
ToTestDisplayString
());
Assert
.
Equal
(
"System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.y { get; }"
,
info2
.
Symbol
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeFieldCreatedInQuery_OperationTree
()
public
void
AnonymousTypeFieldCreatedInQuery_OperationTree
()
{
{
...
@@ -720,6 +727,7 @@ void m()
...
@@ -720,6 +727,7 @@ void m()
Assert
.
Equal
(
"y"
,
info2
.
Symbol
.
ToDisplayString
());
Assert
.
Equal
(
"y"
,
info2
.
Symbol
.
ToDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeFieldCreatedInQuery2_OperationTree
()
public
void
AnonymousTypeFieldCreatedInQuery2_OperationTree
()
{
{
...
@@ -771,6 +779,7 @@ void m()
...
@@ -771,6 +779,7 @@ void m()
Assert
.
Equal
(
"<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)"
,
info0
.
Symbol
.
ToTestDisplayString
());
Assert
.
Equal
(
"<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)"
,
info0
.
Symbol
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeFieldCreatedInLambda_OperationTree
()
public
void
AnonymousTypeFieldCreatedInLambda_OperationTree
()
{
{
...
@@ -829,6 +838,7 @@ void m()
...
@@ -829,6 +838,7 @@ void m()
Assert
.
Equal
(
"<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)"
,
info0
.
Symbol
.
ToTestDisplayString
());
Assert
.
Equal
(
"<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)"
,
info0
.
Symbol
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeFieldCreatedInLambda2_OperationTree
()
public
void
AnonymousTypeFieldCreatedInLambda2_OperationTree
()
{
{
...
@@ -981,6 +991,7 @@ public static void Test1(int x)
...
@@ -981,6 +991,7 @@ public static void Test1(int x)
Assert
.
Equal
(
"<anonymous type: ? aa, ? BB, ? CCC>"
,
info2
.
Type
.
ToTestDisplayString
());
Assert
.
Equal
(
"<anonymous type: ? aa, ? BB, ? CCC>"
,
info2
.
Type
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_Error_Simple_OperationTree
()
public
void
AnonymousTypeSymbols_Error_Simple_OperationTree
()
{
{
...
@@ -1117,6 +1128,7 @@ public static void Test1(int x)
...
@@ -1117,6 +1128,7 @@ public static void Test1(int x)
Assert
.
Equal
(
"<empty anonymous type>"
,
info0
.
Type
.
ToTestDisplayString
());
Assert
.
Equal
(
"<empty anonymous type>"
,
info0
.
Type
.
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
AnonymousTypeSymbols_Error_InUsingStatement_OperationTree
()
public
void
AnonymousTypeSymbols_Error_InUsingStatement_OperationTree
()
{
{
...
@@ -1131,7 +1143,7 @@ public static void Test1(int x)
...
@@ -1131,7 +1143,7 @@ public static void Test1(int x)
}
}
}
}
"
;
"
;
string
expectedOperationTree
=
@"
string
expectedOperationTree
=
@"
IUsingStatement (OperationKind.UsingStatement, IsInvalid) (Syntax: 'using (/*<b ... }')
IUsingStatement (OperationKind.UsingStatement, IsInvalid) (Syntax: 'using (/*<b ... }')
Declaration: IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclarationStatement, IsInvalid) (Syntax: 'var v1 = new { }')
Declaration: IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclarationStatement, IsInvalid) (Syntax: 'var v1 = new { }')
IVariableDeclaration (1 variables) (OperationKind.VariableDeclaration, IsInvalid) (Syntax: 'v1 = new { }')
IVariableDeclaration (1 variables) (OperationKind.VariableDeclaration, IsInvalid) (Syntax: 'v1 = new { }')
...
@@ -1188,6 +1200,7 @@ public static void Test1(int x)
...
@@ -1188,6 +1200,7 @@ public static void Test1(int x)
Assert
.
Equal
(
"System.Double <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.bb { get; }"
,
properties
[
2
].
ToTestDisplayString
());
Assert
.
Equal
(
"System.Double <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.bb { get; }"
,
properties
[
2
].
ToTestDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/20338"
)]
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/20338"
)]
public
void
AnonymousTypeSymbols_Error_DuplicateName_OperationTree
()
public
void
AnonymousTypeSymbols_Error_DuplicateName_OperationTree
()
{
{
...
@@ -1299,6 +1312,7 @@ public class A
...
@@ -1299,6 +1312,7 @@ public class A
Assert
.
Equal
(
"<anonymous type: int a>.a"
,
info
.
Symbol
.
ToDisplayString
());
Assert
.
Equal
(
"<anonymous type: int a>.a"
,
info
.
Symbol
.
ToDisplayString
());
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
Fact
()]
[
Fact
()]
public
void
CheckAnonymousTypeAsConstValue_OperationTree
()
public
void
CheckAnonymousTypeAsConstValue_OperationTree
()
{
{
...
@@ -1353,6 +1367,7 @@ public static void Main()
...
@@ -1353,6 +1367,7 @@ public static void Main()
}"
,
additionalRefs
:
new
[]
{
SystemCoreRef
}).
VerifyDiagnostics
();
}"
,
additionalRefs
:
new
[]
{
SystemCoreRef
}).
VerifyDiagnostics
();
}
}
[
CompilerTrait
(
CompilerFeature
.
IOperation
)]
[
WorkItem
(
546416
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416"
)]
[
WorkItem
(
546416
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416"
)]
[
ClrOnlyFact
]
[
ClrOnlyFact
]
public
void
TestAnonymousTypeInsideGroupBy_Queryable_OperationTree
()
public
void
TestAnonymousTypeInsideGroupBy_Queryable_OperationTree
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录