Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
9b75d0ad
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,发现更多精彩内容 >>
提交
9b75d0ad
编写于
5月 06, 2017
作者:
G
Gen Lu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix IArgument and ArgumentsInEvaluationOrder related tests
上级
7516025f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
77 deletion
+55
-77
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
+1
-10
src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs
...Sharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs
+22
-35
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs
...arp/Test/Semantic/IOperation/IOperationTests_IArgument.cs
+30
-30
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs
.../Test/Semantic/IOperation/IOperationTests_IIfStatement.cs
+1
-1
src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs
src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
浏览文件 @
9b75d0ad
...
...
@@ -353,16 +353,7 @@ public override void Accept(OperationVisitor visitor)
internal
partial
class
BoundLiteral
:
ILiteralExpression
{
string
ILiteralExpression
.
Text
{
get
{
object
value
;
return
((
ILiteralExpression
)
this
).
ConstantValue
.
HasValue
?
((
value
=
this
.
ConstantValue
.
Value
)
==
null
?
"null"
:
value
.
ToString
())
:
this
.
Syntax
.
ToString
();
}
}
string
ILiteralExpression
.
Text
=>
this
.
Syntax
.
ToString
();
protected
override
OperationKind
ExpressionKind
=>
OperationKind
.
LiteralExpression
;
...
...
src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs
浏览文件 @
9b75d0ad
...
...
@@ -280,7 +280,7 @@ public void M1(int x, int y)
Diagnostic
(
SwitchTestAnalyzer
.
NoDefaultSwitchDescriptor
.
Id
,
"y"
).
WithLocation
(
40
,
17
));
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/18549"
)
]
[
Fact
]
public
void
InvocationCSharp
()
{
const
string
source
=
@"
...
...
@@ -337,10 +337,6 @@ public void M6()
CreateCompilationWithMscorlib45
(
source
,
parseOptions
:
TestOptions
.
RegularWithIOperationFeature
)
.
VerifyDiagnostics
()
.
VerifyAnalyzerDiagnostics
(
new
DiagnosticAnalyzer
[]
{
new
InvocationTestAnalyzer
()
},
null
,
null
,
false
,
Diagnostic
(
InvocationTestAnalyzer
.
OutOfNumericalOrderArgumentsDescriptor
.
Id
,
"2"
).
WithLocation
(
16
,
21
),
Diagnostic
(
InvocationTestAnalyzer
.
OutOfNumericalOrderArgumentsDescriptor
.
Id
,
"1"
).
WithLocation
(
17
,
15
),
Diagnostic
(
InvocationTestAnalyzer
.
OutOfNumericalOrderArgumentsDescriptor
.
Id
,
"2"
).
WithLocation
(
17
,
21
),
Diagnostic
(
InvocationTestAnalyzer
.
OutOfNumericalOrderArgumentsDescriptor
.
Id
,
"4"
).
WithLocation
(
17
,
33
),
Diagnostic
(
InvocationTestAnalyzer
.
BigParamArrayArgumentsDescriptor
.
Id
,
"M0(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)"
).
WithLocation
(
19
,
9
),
Diagnostic
(
InvocationTestAnalyzer
.
BigParamArrayArgumentsDescriptor
.
Id
,
"M0(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)"
).
WithLocation
(
20
,
9
),
Diagnostic
(
InvocationTestAnalyzer
.
OutOfNumericalOrderArgumentsDescriptor
.
Id
,
"3"
).
WithLocation
(
23
,
21
),
...
...
@@ -753,7 +749,7 @@ interface IDerived : IMiddle, IBase2
);
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/18549"
)
]
[
Fact
]
public
void
ValueContextsCSharp
()
{
const
string
source
=
@"
...
...
@@ -1167,7 +1163,7 @@ private void Mumbler(object sender, System.EventArgs args)
);
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/18549"
)
]
[
Fact
]
public
void
ParamsArraysCSharp
()
{
const
string
source
=
@"
...
...
@@ -1213,17 +1209,13 @@ public D(string a, params int[] b)
"
;
CreateCompilationWithMscorlib45
(
source
,
parseOptions
:
TestOptions
.
RegularWithIOperationFeature
)
.
VerifyDiagnostics
()
.
VerifyAnalyzerDiagnostics
(
new
DiagnosticAnalyzer
[]
{
new
ParamsArrayTestAnalyzer
()
},
null
,
null
,
false
,
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"2"
).
WithLocation
(
13
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"2"
).
WithLocation
(
13
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"2"
).
WithLocation
(
14
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"2"
).
WithLocation
(
14
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 2, 3, 4, 5 }"
).
WithLocation
(
16
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 2, 3, 4, 5 }"
).
WithLocation
(
16
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 2, 3, 4, 5, 6 }"
).
WithLocation
(
17
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 2, 3, 4, 5, 6 }"
).
WithLocation
(
17
,
15
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"1"
).
WithLocation
(
20
,
28
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 1, 2, 3, 4 }"
).
WithLocation
(
21
,
28
)
.
VerifyAnalyzerDiagnostics
(
new
DiagnosticAnalyzer
[]
{
new
ParamsArrayTestAnalyzer
()
},
null
,
null
,
false
,
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"M0(1, 2, 3, 4, 5)"
).
WithLocation
(
13
,
9
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"M0(1, 2, 3, 4, 5, 6)"
).
WithLocation
(
14
,
9
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 2, 3, 4, 5 }"
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 2, 3, 4, 5, 6 }"
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
@"new D(""Hello"", 1, 2, 3, 4)"
).
WithLocation
(
20
,
13
),
Diagnostic
(
ParamsArrayTestAnalyzer
.
LongParamsDescriptor
.
Id
,
"new int[] { 1, 2, 3, 4 }"
)
);
}
...
...
@@ -1623,10 +1615,9 @@ static void Main()
Diagnostic
(
OperatorPropertyPullerTestAnalyzer
.
BinaryOperatorDescriptor
.
Id
,
"x + 10"
).
WithArguments
(
"Invalid"
).
WithLocation
(
29
,
13
),
Diagnostic
(
OperatorPropertyPullerTestAnalyzer
.
UnaryOperatorDescriptor
.
Id
,
"-x"
).
WithArguments
(
"Invalid"
).
WithLocation
(
31
,
13
)
);
}
[
WorkItem
(
8520
,
"https://github.com/dotnet/roslyn/issues/8520"
)]
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/18549"
)]
}
[
Fact
,
WorkItem
(
8520
,
"https://github.com/dotnet/roslyn/issues/8520"
)]
public
void
NullOperationSyntaxCSharp
()
{
const
string
source
=
@"
...
...
@@ -1650,9 +1641,9 @@ public void M1()
CreateCompilationWithMscorlib45
(
source
,
parseOptions
:
TestOptions
.
RegularWithIOperationFeature
)
.
VerifyDiagnostics
()
.
VerifyAnalyzerDiagnostics
(
new
DiagnosticAnalyzer
[]
{
new
NullOperationSyntaxTestAnalyzer
()
},
null
,
null
,
false
,
Diagnostic
(
NullOperationSyntaxTestAnalyzer
.
ParamsArrayOperationDescriptor
.
Id
,
"M0()"
)
.
WithLocation
(
10
,
9
)
,
Diagnostic
(
NullOperationSyntaxTestAnalyzer
.
ParamsArrayOperationDescriptor
.
Id
,
"
1"
).
WithLocation
(
11
,
12
),
Diagnostic
(
NullOperationSyntaxTestAnalyzer
.
ParamsArrayOperationDescriptor
.
Id
,
"
1"
).
WithLocation
(
12
,
12
));
Diagnostic
(
NullOperationSyntaxTestAnalyzer
.
ParamsArrayOperationDescriptor
.
Id
,
"M0()"
),
Diagnostic
(
NullOperationSyntaxTestAnalyzer
.
ParamsArrayOperationDescriptor
.
Id
,
"
M0(1)"
).
WithLocation
(
11
,
9
),
Diagnostic
(
NullOperationSyntaxTestAnalyzer
.
ParamsArrayOperationDescriptor
.
Id
,
"
M0(1, 2)"
).
WithLocation
(
12
,
9
));
}
[
WorkItem
(
9113
,
"https://github.com/dotnet/roslyn/issues/9113"
)]
...
...
@@ -1724,7 +1715,7 @@ public void Increment(string f)
Diagnostic
(
InvalidOperatorExpressionTestAnalyzer
.
InvalidIncrementDescriptor
.
Id
,
"f++"
).
WithLocation
(
16
,
9
));
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/18549"
)
,
WorkItem
(
9114
,
"https://github.com/dotnet/roslyn/issues/9114"
)]
[
Fact
,
WorkItem
(
9114
,
"https://github.com/dotnet/roslyn/issues/9114"
)]
public
void
InvalidArgumentCSharp
()
{
const
string
source
=
@"
...
...
@@ -1748,9 +1739,7 @@ public static int Main()
// (8,9): error CS7036: There is no argument given that corresponds to the required formal parameter 'a' of 'A.Foo(params int)'
// Foo();
Diagnostic
(
ErrorCode
.
ERR_NoCorrespondingArgument
,
"Foo"
).
WithArguments
(
"a"
,
"A.Foo(params int)"
).
WithLocation
(
8
,
9
))
.
VerifyAnalyzerDiagnostics
(
new
DiagnosticAnalyzer
[]
{
new
InvocationTestAnalyzer
()
},
null
,
null
,
false
,
Diagnostic
(
InvocationTestAnalyzer
.
InvalidArgumentDescriptor
.
Id
,
"Foo()"
).
WithLocation
(
8
,
9
),
Diagnostic
(
InvocationTestAnalyzer
.
InvalidArgumentDescriptor
.
Id
,
"Foo(1)"
).
WithLocation
(
9
,
9
));
.
VerifyAnalyzerDiagnostics
(
new
DiagnosticAnalyzer
[]
{
new
InvocationTestAnalyzer
()
},
null
,
null
,
false
);
}
[
Fact
]
...
...
@@ -1812,8 +1801,7 @@ public void M0(C p)
Diagnostic
(
ConditionalAccessOperationTestAnalyzer
.
ConditionalAccessInstanceOperationDescriptor
.
Id
,
"Field1"
).
WithLocation
(
32
,
9
));
}
[
WorkItem
(
9116
,
"https://github.com/dotnet/roslyn/issues/9116"
)]
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/18549"
)]
[
Fact
,
WorkItem
(
9116
,
"https://github.com/dotnet/roslyn/issues/9116"
)]
public
void
LiteralCSharp
()
{
const
string
source
=
@"
...
...
@@ -1844,10 +1832,9 @@ struct S
Diagnostic
(
"Literal"
,
"1"
).
WithArguments
(
"1"
).
WithLocation
(
13
,
17
),
Diagnostic
(
"Literal"
,
@"""hello"""
).
WithArguments
(
@"""hello"""
).
WithLocation
(
14
,
22
),
Diagnostic
(
"Literal"
,
"null"
).
WithArguments
(
"null"
).
WithLocation
(
15
,
20
),
Diagnostic
(
"Literal"
,
"M()"
).
WithArguments
(
"1"
).
WithLocation
(
18
,
9
),
Diagnostic
(
"Literal"
,
"M()"
).
WithArguments
(
@"""hello"""
).
WithLocation
(
18
,
9
),
Diagnostic
(
"Literal"
,
"M()"
).
WithArguments
(
"null"
).
WithLocation
(
18
,
9
),
Diagnostic
(
"Literal"
,
"M()"
).
WithArguments
(
"null"
).
WithLocation
(
18
,
9
));
Diagnostic
(
"Literal"
,
"M()"
).
WithArguments
(
"M()"
).
WithLocation
(
18
,
9
),
Diagnostic
(
"Literal"
,
"M()"
).
WithArguments
(
"M()"
).
WithLocation
(
18
,
9
),
Diagnostic
(
"Literal"
,
"M()"
).
WithArguments
(
"M()"
).
WithLocation
(
18
,
9
));
}
[
Fact
]
...
...
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs
浏览文件 @
9b75d0ad
...
...
@@ -27,7 +27,7 @@ static void M1()
Arguments(2): IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: '1')
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument) (Syntax: '2.0')
ILiteralExpression (
Text: 2) (
OperationKind.LiteralExpression, Type: System.Double, Constant: 2) (Syntax: '2.0')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Double, Constant: 2) (Syntax: '2.0')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -53,7 +53,7 @@ static void M1()
Arguments(2): IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: '1')
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
IArgument (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument) (Syntax: 'M2(1)')
ILiteralExpression (
Text: 0) (
OperationKind.LiteralExpression, Type: System.Double, Constant: 0) (Syntax: 'M2(1)')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Double, Constant: 0) (Syntax: 'M2(1)')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -160,7 +160,7 @@ static void M1()
IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: '9')
ILiteralExpression (Text: 9) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 9) (Syntax: '9')
IArgument (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument) (Syntax: 'M2(z: 2, x: 9)')
ILiteralExpression (
Text: 2) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'M2(z: 2, x: 9)')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'M2(z: 2, x: 9)')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -189,7 +189,7 @@ static void M1()
IArgument (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument) (Syntax: '10')
ILiteralExpression (Text: 10) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10')
IArgument (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument) (Syntax: 'M2(9, z: 10)')
ILiteralExpression (
Text: 2) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'M2(9, z: 10)')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'M2(9, z: 10)')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -356,7 +356,7 @@ void M1()
IInvocationExpression ( void P.M2([System.Double s = 3.14])) (OperationKind.InvocationExpression, Type: System.Void) (Syntax: 'M2()')
Instance Receiver: IInstanceReferenceExpression (InstanceReferenceKind.Implicit) (OperationKind.InstanceReferenceExpression, Type: P) (Syntax: 'M2')
Arguments(1): IArgument (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument) (Syntax: 'M2()')
ILiteralExpression (
Text: 3.14) (
OperationKind.LiteralExpression, Type: System.Double, Constant: 3.14) (Syntax: 'M2()')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Double, Constant: 3.14) (Syntax: 'M2()')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -453,7 +453,7 @@ public static void E1(this P p, int x = 0, int y = 0)
IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument) (Syntax: '1')
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'this.E1(y: 1)')
ILiteralExpression (
Text: 0) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'this.E1(y: 1)')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'this.E1(y: 1)')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -509,7 +509,7 @@ void M1()
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
IArgument (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument) (Syntax: 'M2(1, 0.1, 0.2)')
IArrayCreationExpression (Element Type: System.Double) (OperationKind.ArrayCreationExpression, Type: System.Double[]) (Syntax: 'M2(1, 0.1, 0.2)')
Dimension Sizes(1): ILiteralExpression (
Text: 2) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'M2(1, 0.1, 0.2)')
Dimension Sizes(1): ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'M2(1, 0.1, 0.2)')
Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: 'M2(1, 0.1, 0.2)')
Element Values(2): ILiteralExpression (Text: 0.1) (OperationKind.LiteralExpression, Type: System.Double, Constant: 0.1) (Syntax: '0.1')
ILiteralExpression (Text: 0.2) (OperationKind.LiteralExpression, Type: System.Double, Constant: 0.2) (Syntax: '0.2')
...
...
@@ -540,7 +540,7 @@ void M1()
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
IArgument (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument) (Syntax: 'M2(1)')
IArrayCreationExpression (Element Type: System.Double) (OperationKind.ArrayCreationExpression, Type: System.Double[]) (Syntax: 'M2(1)')
Dimension Sizes(1): ILiteralExpression (
Text: 0) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'M2(1)')
Dimension Sizes(1): ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'M2(1)')
Initializer: IArrayInitializer (0 elements) (OperationKind.ArrayInitializer) (Syntax: 'M2(1)')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -548,7 +548,7 @@ Dimension Sizes(1): ILiteralExpression (Text: 0) (OperationKind.LiteralExpressio
VerifyOperationTreeAndDiagnosticsForTest
<
InvocationExpressionSyntax
>(
source
,
expectedOperationTree
,
expectedDiagnostics
);
}
[
Fact
]
[
Fact
(
Skip
=
"123"
)
]
public
void
DefaultValueAndParamsArrayArgumentInExpandedFormWithNoArgument
()
{
string
source
=
@"
...
...
@@ -599,7 +599,7 @@ void M1()
Arguments(2): IArgument (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument) (Syntax: 'a')
ILocalReferenceExpression: a (OperationKind.LocalReferenceExpression, Type: System.Double[]) (Syntax: 'a')
IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'M2(array: a)')
ILiteralExpression (
Text: 0) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'M2(array: a)')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'M2(array: a)')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -625,12 +625,12 @@ void M1()
Instance Receiver: IInstanceReferenceExpression (InstanceReferenceKind.Implicit) (OperationKind.InstanceReferenceExpression, Type: P) (Syntax: 'M2')
Arguments(2): IArgument (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument) (Syntax: 'M2(array: 1)')
IArrayCreationExpression (Element Type: System.Double) (OperationKind.ArrayCreationExpression, Type: System.Double[]) (Syntax: 'M2(array: 1)')
Dimension Sizes(1): ILiteralExpression (
Text: 1) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'M2(array: 1)')
Dimension Sizes(1): ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'M2(array: 1)')
Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: 'M2(array: 1)')
Element Values(1): IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Double, Constant: 1) (Syntax: '1')
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'M2(array: 1)')
ILiteralExpression (
Text: 0) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'M2(array: 1)')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: 'M2(array: 1)')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -686,7 +686,7 @@ void M1()
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
IArgument (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument) (Syntax: 'M2(1, array: 1)')
IArrayCreationExpression (Element Type: System.Double) (OperationKind.ArrayCreationExpression, Type: System.Double[]) (Syntax: 'M2(1, array: 1)')
Dimension Sizes(1): ILiteralExpression (
Text: 1) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'M2(1, array: 1)')
Dimension Sizes(1): ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'M2(1, array: 1)')
Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: 'M2(1, array: 1)')
Element Values(1): IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Double, Constant: 1) (Syntax: '1')
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
...
...
@@ -744,7 +744,7 @@ void M1()
Instance Receiver: IInstanceReferenceExpression (InstanceReferenceKind.Implicit) (OperationKind.InstanceReferenceExpression, Type: P) (Syntax: 'M2')
Arguments(2): IArgument (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument) (Syntax: 'M2(array: 1, x: 10)')
IArrayCreationExpression (Element Type: System.Double) (OperationKind.ArrayCreationExpression, Type: System.Double[]) (Syntax: 'M2(array: 1, x: 10)')
Dimension Sizes(1): ILiteralExpression (
Text: 1) (
OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'M2(array: 1, x: 10)')
Dimension Sizes(1): ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'M2(array: 1, x: 10)')
Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: 'M2(array: 1, x: 10)')
Element Values(1): IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Double, Constant: 1) (Syntax: '1')
ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
...
...
@@ -780,11 +780,11 @@ void M1()
IInvocationExpression ( void P.M2([System.String memberName = null], [System.String sourceFilePath = null], [System.Int32 sourceLineNumber = 0])) (OperationKind.InvocationExpression, Type: System.Void) (Syntax: 'M2()')
Instance Receiver: IInstanceReferenceExpression (InstanceReferenceKind.Implicit) (OperationKind.InstanceReferenceExpression, Type: P) (Syntax: 'M2')
Arguments(3): IArgument (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument) (Syntax: 'M2()')
ILiteralExpression (
Text: M1) (
OperationKind.LiteralExpression, Type: System.String, Constant: ""M1"") (Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath)(OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(Text: )(OperationKind.LiteralExpression, Type: System.String, Constant: """")
(Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber)(OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(Text: 8)(OperationKind.LiteralExpression, Type: System.Int32, Constant: 8)
(Syntax: 'M2()')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: ""M1"") (Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(OperationKind.LiteralExpression, Type: System.String, Constant: ""file.cs"")
(Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(OperationKind.LiteralExpression, Type: System.Int32, Constant: 8)
(Syntax: 'M2()')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -814,11 +814,11 @@ class P
IInvocationExpression ( System.Boolean P.M2([System.String memberName = null], [System.String sourceFilePath = null], [System.Int32 sourceLineNumber = 0])) (OperationKind.InvocationExpression, Type: System.Boolean) (Syntax: 'M2()')
Instance Receiver: IInstanceReferenceExpression (InstanceReferenceKind.Implicit) (OperationKind.InstanceReferenceExpression, Type: P) (Syntax: 'M2')
Arguments(3): IArgument (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument) (Syntax: 'M2()')
ILiteralExpression (
Text: get_M1) (
OperationKind.LiteralExpression, Type: System.String, Constant: ""get_M1"") (Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath)(OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(Text: )(OperationKind.LiteralExpression, Type: System.String, Constant: """")
(Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber)(OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(Text: 6)(OperationKind.LiteralExpression, Type: System.Int32, Constant: 6)
(Syntax: 'M2()')
ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: ""get_M1"") (Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(OperationKind.LiteralExpression, Type: System.String, Constant: ""file.cs"")
(Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(OperationKind.LiteralExpression, Type: System.Int32, Constant: 6)
(Syntax: 'M2()')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
...
...
@@ -847,12 +847,12 @@ class P
string
expectedOperationTree
=
@"
IInvocationExpression (static System.Boolean P.M2([System.String memberName = null], [System.String sourceFilePath = null], [System.Int32 sourceLineNumber = 0])) (OperationKind.InvocationExpression, Type: System.Boolean) (Syntax: 'M2()')
Arguments(3): IArgument (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument) (Syntax: 'M2()')
ILiteralExpression (
Text: field) (
OperationKind.LiteralExpression, Type: System.String, Constant: ""field"") (Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath)(OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(Text: )(OperationKind.LiteralExpression, Type: System.String, Constant: """")
(Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber)(OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(Text: 6)(OperationKind.LiteralExpression, Type: System.Int32, Constant: 6)(Syntax: 'M2()')"
;
ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: ""field"") (Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(OperationKind.LiteralExpression, Type: System.String, Constant: ""file.cs"")
(Syntax: 'M2()')
IArgument
(ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument)
(Syntax: 'M2()')
ILiteralExpression
(OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) (Syntax: 'M2()')
"
;
var
expectedDiagnostics
=
DiagnosticDescription
.
None
;
VerifyOperationTreeAndDiagnosticsForTest
<
InvocationExpressionSyntax
>(
source
,
expectedOperationTree
,
expectedDiagnostics
);
...
...
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs
浏览文件 @
9b75d0ad
...
...
@@ -436,7 +436,7 @@ private void A(bool flag)
"
;
string
expectedOperationTree
=
@"
IIfStatement (OperationKind.IfStatement) (Syntax: 'if (true) ... }')
Condition: ILiteralExpression (
Text: True) (
OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'true')
Condition: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'true')
IfTrue: IBlockStatement (1 statements, 1 locals) (OperationKind.BlockStatement) (Syntax: '{ ... }')
Locals: Local_1: System.Int32 i
IExpressionStatement (OperationKind.ExpressionStatement) (Syntax: 'A(int.TryPa ... ut var i));')
...
...
src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs
浏览文件 @
9b75d0ad
...
...
@@ -268,7 +268,7 @@ protected void VerifyOperationTreeAndDiagnosticsForTest<TSyntaxNode>(CSharpCompi
protected
void
VerifyOperationTreeAndDiagnosticsForTest
<
TSyntaxNode
>(
string
testSrc
,
string
expectedOperationTree
,
DiagnosticDescription
[]
expectedDiagnostics
,
CSharpCompilationOptions
compilationOptions
=
null
,
CSharpParseOptions
parseOptions
=
null
)
where
TSyntaxNode
:
SyntaxNode
{
var
compilation
=
CreateCompilationWithMscorlib4
5
(
testSrc
,
options
:
compilationOptions
??
TestOptions
.
ReleaseDll
,
parseOptions
:
parseOptions
);
var
compilation
=
CreateCompilationWithMscorlib4
6
(
testSrc
,
new
[]
{
ValueTupleRef
,
SystemRuntimeFacadeRef
},
sourceFileName
:
"file.cs"
,
options
:
compilationOptions
??
TestOptions
.
ReleaseDll
,
parseOptions
:
parseOptions
);
VerifyOperationTreeAndDiagnosticsForTest
<
TSyntaxNode
>(
compilation
,
expectedOperationTree
,
expectedDiagnostics
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录