Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3b41e7f7
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,发现更多精彩内容 >>
提交
3b41e7f7
编写于
3月 20, 2014
作者:
C
ChuckStoner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
VB: Fix up circular Enum definition tests (changeset 1210310)
上级
abd7654e
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
40 addition
and
22 deletion
+40
-22
Src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Source/EnumTests.vb
.../VisualBasic/Test/Symbol/SymbolsTests/Source/EnumTests.vb
+40
-22
未找到文件。
Src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Source/EnumTests.vb
浏览文件 @
3b41e7f7
...
...
@@ -1181,7 +1181,41 @@ BC30650: Enums must be declared as an integral type.
Assert
.
Equal
(
type
.
SpecialType
,
SpecialType
.
System_Int32
)
End
Sub
<
Fact
,
WorkItem
(
843037
)
>
<
Fact
,
WorkItem
(
895284
)
>
Public
Sub
CircularDefinition_Explicit
()
' Bug#895284 Roslyn gives extra error BC30060:
' Conversion from 'E2' to 'Integer' cannot occur in a constant expression.
' Per field
Dim
source
=
<
compilation
>
<
file
name
=
"a.vb"
>
Enum
E1
M10
=
1
M11
=
CType
(
M10
,
Integer
)
+
1
M12
=
CType
(
M11
,
Integer
)
+
1
End
Enum
Enum
E2
M20
=
CType
(
M22
,
Integer
)
+
1
M21
=
CType
(
M20
,
Integer
)
+
1
M22
=
CType
(
M21
,
Integer
)
+
1
End
Enum
</
file
>
</
compilation
>
Dim
comp
=
CompilationUtils
.
CreateCompilationWithMscorlib
(
source
)
comp
.
AssertTheseDiagnostics
(
<
errors
>
BC30500
:
Constant
'M20' cannot depend on its own value.
M20
=
CType
(
M22
,
Integer
)
+
1
~~~
BC30060
:
Conversion
from
'E2' to 'Integer' cannot occur in a constant expression.
M21
=
CType
(
M20
,
Integer
)
+
1
~~~
BC30060
:
Conversion
from
'E2' to 'Integer' cannot occur in a constant expression.
M22
=
CType
(
M21
,
Integer
)
+
1
~~~
</
errors
>
)
End
Sub
<
Fact
>
Public
Sub
CircularDefinitionManyMembers_Implicit
()
' Enum E
' M0 = Mn + 1
...
...
@@ -1198,7 +1232,7 @@ BC30500: Constant 'M0' cannot depend on its own value.
</
errors
>
)
End
Sub
<
Fact
,
WorkItem
(
843037
),
WorkItem
(
895284
)
>
<
Fact
(
Skip
:
=
"886047"
),
WorkItem
(
886047
)
>
Public
Sub
CircularDefinitionManyMembers_Explicit
()
' Enum E
' M0 = Mn + 1
...
...
@@ -1207,32 +1241,16 @@ BC30500: Constant 'M0' cannot depend on its own value.
' Mn = Mn-1 + 1
' End Enum
' Dev12 crashes at ~300 members.
' Bug#895284 Roslyn gives extra error BC30060:
' Conversion from 'E2' to 'Integer' cannot occur in a constant expression.
' Per field
Dim
source
=
GenerateEnum
(
5
,
Function
(
i
,
n
)
String
.
Format
(
"CType(M{0}, Integer) + 1"
,
If
(
i
=
0
,
n
-
1
,
i
-
1
)))
Dim
source
=
GenerateEnum
(
6000
,
Function
(
i
,
n
)
String
.
Format
(
"M{0} + 1"
,
If
(
i
=
0
,
n
-
1
,
i
-
1
)))
Dim
comp
=
CompilationUtils
.
CreateCompilationWithMscorlib
(
source
)
comp
.
AssertTheseDiagnostics
(
<
errors
>
BC30500
:
Constant
'M0' cannot depend on its own value.
M0
=
CType
(
M4
,
Integer
)
+
1
~~
BC30060
:
Conversion
from
'E' to 'Integer' cannot occur in a constant expression.
M1
=
CType
(
M0
,
Integer
)
+
1
~~
BC30060
:
Conversion
from
'E' to 'Integer' cannot occur in a constant expression.
M2
=
CType
(
M1
,
Integer
)
+
1
~~
BC30060
:
Conversion
from
'E' to 'Integer' cannot occur in a constant expression.
M3
=
CType
(
M2
,
Integer
)
+
1
~~
BC30060
:
Conversion
from
'E' to 'Integer' cannot occur in a constant expression.
M4
=
CType
(
M3
,
Integer
)
+
1
M0
=
M5999
+
1
~~
</
errors
>
)
End
Sub
<
Fact
,
WorkItem
(
843037
)
>
<
Fact
(
Skip
:
=
"886047"
),
WorkItem
(
886047
)
>
Public
Sub
InvertedDefinitionManyMembers_Explicit
()
' Enum E
' M0 = M1 - 1
...
...
@@ -1241,7 +1259,7 @@ BC30060: Conversion from 'E' to 'Integer' cannot occur in a constant expression.
' Mn = n
' End Enum
' Dev12 crashes at ~300 members.
Dim
source
=
GenerateEnum
(
3
00
,
Function
(
i
,
n
)
If
(
i
<
n
-
1
,
String
.
Format
(
"M{0} - 1"
,
i
+
1
),
i
.
ToString
()))
Dim
source
=
GenerateEnum
(
60
00
,
Function
(
i
,
n
)
If
(
i
<
n
-
1
,
String
.
Format
(
"M{0} - 1"
,
i
+
1
),
i
.
ToString
()))
Dim
comp
=
CompilationUtils
.
CreateCompilationWithMscorlib
(
source
)
comp
.
AssertTheseDiagnostics
(
<
errors
/>
)
End
Sub
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录