Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c6e78911
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,发现更多精彩内容 >>
未验证
提交
c6e78911
编写于
7月 10, 2017
作者:
F
Fredric Silberberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added OperatorMethod tests.
上级
d34fadc4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
99 addition
and
1 deletion
+99
-1
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb
...antic/IOperation/IOperationTests_IConversionExpression.vb
+99
-1
未找到文件。
src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb
浏览文件 @
c6e78911
...
...
@@ -2082,6 +2082,104 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
VerifyOperationTreeAndDiagnosticsForTest
(
Of
LocalDeclarationStatementSyntax
)(
source
,
expectedOperationTree
,
expectedDiagnostics
)
End
Sub
<
Fact
()
>
Public
Sub
ConversionExpression_Implicit_WideningUserConversion
()
Dim
source
=
<
!
[
CDATA
[
Module
Program
Sub
M1
(
args
As
String
())
Dim
i
As
Integer
=
1
Dim
c1
As
C1
=
i
'BIND:"Dim c1 As C1 = i"
End
Sub
Class
C1
Public
Shared
Widening
Operator
CType
(
ByVal
i
As
Integer
)
As
C1
Return
New
C1
End
Operator
End
Class
End
Module
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IVariableDeclarationStatement
(
1
declarations
)
(
OperationKind
.
VariableDeclarationStatement
)
(
Syntax
:
'Dim c1 As C1 = i')
IVariableDeclaration
(
1
variables
)
(
OperationKind
.
VariableDeclaration
)
(
Syntax
:
'c1')
Variables
:
Local_1
:
c1
As
Program
.
C1
Initializer
:
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Implicit
)
(
OperationKind
.
ConversionExpression
,
Type
:
Program
.
C1
)
(
Syntax
:
'i')
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Implicit
)
(
OperatorMethod
:
Function
Program
.
C1
.
op_Implicit
(
i
As
System
.
Int32
)
As
Program
.
C1
)
(
OperationKind
.
ConversionExpression
,
Type
:
System
.
Int32
)
(
Syntax
:
'i')
ILocalReferenceExpression
:
i
(
OperationKind
.
LocalReferenceExpression
,
Type
:
System
.
Int32
)
(
Syntax
:
'i')
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
VerifyOperationTreeAndDiagnosticsForTest
(
Of
LocalDeclarationStatementSyntax
)(
source
,
expectedOperationTree
,
expectedDiagnostics
)
End
Sub
<
Fact
()
>
Public
Sub
ConversionExpression_Implicit_WideningUserConversionMultiStepConversion
()
Dim
source
=
<
!
[
CDATA
[
Module
Program
Sub
M1
(
args
As
String
())
Dim
i
As
Integer
=
1
Dim
c1
As
C1
=
i
'BIND:"Dim c1 As C1 = i"
End
Sub
Class
C1
Public
Shared
Widening
Operator
CType
(
ByVal
i
As
Long
)
As
C1
Return
New
C1
End
Operator
End
Class
End
Module
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IVariableDeclarationStatement
(
1
declarations
)
(
OperationKind
.
VariableDeclarationStatement
)
(
Syntax
:
'Dim c1 As C1 = i')
IVariableDeclaration
(
1
variables
)
(
OperationKind
.
VariableDeclaration
)
(
Syntax
:
'c1')
Variables
:
Local_1
:
c1
As
Program
.
C1
Initializer
:
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Implicit
)
(
OperationKind
.
ConversionExpression
,
Type
:
Program
.
C1
)
(
Syntax
:
'i')
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Implicit
)
(
OperatorMethod
:
Function
Program
.
C1
.
op_Implicit
(
i
As
System
.
Int64
)
As
Program
.
C1
)
(
OperationKind
.
ConversionExpression
,
Type
:
System
.
Int32
)
(
Syntax
:
'i')
ILocalReferenceExpression
:
i
(
OperationKind
.
LocalReferenceExpression
,
Type
:
System
.
Int32
)
(
Syntax
:
'i')
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
VerifyOperationTreeAndDiagnosticsForTest
(
Of
LocalDeclarationStatementSyntax
)(
source
,
expectedOperationTree
,
expectedDiagnostics
)
End
Sub
<
Fact
()
>
Public
Sub
ConversionExpression_Implicit_WideningUserConversionImplicitAndExplicitConversion
()
Dim
source
=
<
!
[
CDATA
[
Module
Program
Sub
M1
(
args
As
String
())
Dim
c1
As
New
C1
Dim
c2
As
C2
=
CType
(
c1
,
Integer
)
'BIND:"Dim c2 As C2 = CType(c1, Integer)"
End
Sub
Class
C1
Public
Shared
Widening
Operator
CType
(
ByVal
i
As
C1
)
As
Integer
Return
1
End
Operator
End
Class
Class
C2
Public
Shared
Widening
Operator
CType
(
ByVal
l
As
Long
)
As
C2
Return
New
C2
End
Operator
End
Class
End
Module
]]
>
.
Value
Dim
expectedOperationTree
=
<
!
[
CDATA
[
IVariableDeclarationStatement
(
1
declarations
)
(
OperationKind
.
VariableDeclarationStatement
)
(
Syntax
:
'Dim c2 As C ... 1, Integer)')
IVariableDeclaration
(
1
variables
)
(
OperationKind
.
VariableDeclaration
)
(
Syntax
:
'c2')
Variables
:
Local_1
:
c2
As
Program
.
C2
Initializer
:
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Implicit
)
(
OperationKind
.
ConversionExpression
,
Type
:
Program
.
C2
)
(
Syntax
:
'CType(c1, Integer)')
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Implicit
)
(
OperatorMethod
:
Function
Program
.
C2
.
op_Implicit
(
l
As
System
.
Int64
)
As
Program
.
C2
)
(
OperationKind
.
ConversionExpression
,
Type
:
System
.
Int32
)
(
Syntax
:
'CType(c1, Integer)')
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Explicit
)
(
OperationKind
.
ConversionExpression
,
Type
:
System
.
Int32
)
(
Syntax
:
'CType(c1, Integer)')
IConversionExpression
(
ConversionKind
.
OperatorMethod
,
Implicit
)
(
OperatorMethod
:
Function
Program
.
C1
.
op_Implicit
(
i
As
Program
.
C1
)
As
System
.
Int32
)
(
OperationKind
.
ConversionExpression
,
Type
:
Program
.
C1
)
(
Syntax
:
'CType(c1, Integer)')
ILocalReferenceExpression
:
c1
(
OperationKind
.
LocalReferenceExpression
,
Type
:
Program
.
C1
)
(
Syntax
:
'c1')
]]
>
.
Value
Dim
expectedDiagnostics
=
String
.
Empty
VerifyOperationTreeAndDiagnosticsForTest
(
Of
LocalDeclarationStatementSyntax
)(
source
,
expectedOperationTree
,
expectedDiagnostics
)
End
Sub
#End Region
Private
Class
ExpectedSymbolVerifier
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录