Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5a68b24a
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,发现更多精彩内容 >>
提交
5a68b24a
编写于
9月 08, 2014
作者:
A
AlekseyTs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move VB Conditional Access expressions under LanguageVersion.Experimental. (changeset 1331138)
上级
26d35853
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
85 addition
and
28 deletion
+85
-28
Src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb
...pilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb
+1
-1
Src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb
Src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb
+4
-0
Src/Compilers/VisualBasic/Portable/Parser/ParseExpression.vb
Src/Compilers/VisualBasic/Portable/Parser/ParseExpression.vb
+5
-0
Src/Compilers/VisualBasic/Test/Semantic/Semantics/ConditionalAccessTests.vb
...alBasic/Test/Semantic/Semantics/ConditionalAccessTests.vb
+75
-27
未找到文件。
Src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb
浏览文件 @
5a68b24a
...
...
@@ -99,7 +99,7 @@ Friend Module CompilationUtils
Public
Function
CreateCompilationWithMscorlibAndVBRuntime
(
sources
As
XElement
,
options
As
VisualBasicCompilationOptions
)
As
VisualBasicCompilation
Return
CreateCompilationWithMscorlibAndVBRuntime
(
sources
,
Nothing
,
options
)
Return
CreateCompilationWithMscorlibAndVBRuntime
(
sources
,
Nothing
,
options
,
parseOptions
:
=
If
(
options
Is
Nothing
,
Nothing
,
options
.
ParseOptions
)
)
End
Function
Public
ReadOnly
XmlReferences
As
MetadataReference
()
=
{
SystemRef
,
SystemCoreRef
,
SystemXmlRef
,
SystemXmlLinqRef
}
...
...
Src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb
浏览文件 @
5a68b24a
...
...
@@ -8,6 +8,10 @@ Public Class TestOptions
Public
Shared
ReadOnly
ReleaseDll
As
New
VisualBasicCompilationOptions
(
OutputKind
.
DynamicallyLinkedLibrary
,
optimizationLevel
:
=
OptimizationLevel
.
Release
)
Public
Shared
ReadOnly
ReleaseExe
As
New
VisualBasicCompilationOptions
(
OutputKind
.
ConsoleApplication
,
optimizationLevel
:
=
OptimizationLevel
.
Release
)
Public
Shared
ReadOnly
ExperimentalReleaseExe
As
New
VisualBasicCompilationOptions
(
OutputKind
.
ConsoleApplication
,
optimizationLevel
:
=
OptimizationLevel
.
Release
,
parseOptions
:
=
New
VisualBasicParseOptions
(
kind
:
=
SourceCodeKind
.
Regular
,
languageVersion
:
=
LanguageVersion
.
Experimental
))
Public
Shared
ReadOnly
DebugDll
As
New
VisualBasicCompilationOptions
(
OutputKind
.
DynamicallyLinkedLibrary
,
optimizationLevel
:
=
OptimizationLevel
.
Debug
)
Public
Shared
ReadOnly
DebugExe
As
New
VisualBasicCompilationOptions
(
OutputKind
.
ConsoleApplication
,
optimizationLevel
:
=
OptimizationLevel
.
Debug
)
...
...
Src/Compilers/VisualBasic/Portable/Parser/ParseExpression.vb
浏览文件 @
5a68b24a
...
...
@@ -481,6 +481,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax
End
Function
Private
Function
CanStartConsequenceExpression
(
kind
As
SyntaxKind
,
qualified
As
Boolean
)
As
Boolean
If
_scanner
.
Options
.
LanguageVersion
<>
LanguageVersion
.
Experimental
Then
Return
False
End
If
Return
kind
=
SyntaxKind
.
DotToken
OrElse
kind
=
SyntaxKind
.
ExclamationToken
OrElse
(
qualified
AndAlso
kind
=
SyntaxKind
.
OpenParenToken
)
End
Function
...
...
Src/Compilers/VisualBasic/Test/Semantic/Semantics/ConditionalAccessTests.vb
浏览文件 @
5a68b24a
...
...
@@ -17,6 +17,54 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics
Public
Class
ConditionalAccessTests
Inherits
BasicTestBase
<
Fact
()
>
Public
Sub
DisabledIfNotExperimental
()
Dim
compilationDef
=
<
compilation
>
<
file
name
=
"a.vb"
>
Module
Module1
Sub
Main
()
End
Sub
Sub
Test2
(
x
As
S1
?
)
System
.
Console
.
WriteLine
(
x
?
.
M2
())
System
.
Console
.
WriteLine
(
?
.
M2
())
?
.
M2
()
End
Sub
End
Module
Structure
S1
Sub
M2
()
System
.
Console
.
WriteLine
(
"S1.M2"
)
End
Sub
End
Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
BC36637
:
The
'?' character cannot be used here.
System
.
Console
.
WriteLine
(
x
?
.
M2
())
~
BC30201
:
Expression
expected
.
System
.
Console
.
WriteLine
(
?
.
M2
())
~
BC36637
:
The
'?' character cannot be used here.
System
.
Console
.
WriteLine
(
?
.
M2
())
~
BC31003
:
Expression
statement
is
only
allowed
at
the
end
of
an
interactive
submission
.
?.
M2
()
~~~~~~
BC30157
:
Leading
'.' or '!' can only appear inside a 'With' statement.
?
.
M2
()
~~~
</
expected
>
)
End
Sub
<
Fact
()
>
Public
Sub
Simple1
()
...
...
@@ -126,7 +174,7 @@ End Class
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -240,7 +288,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -308,7 +356,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
...
...
@@ -351,7 +399,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
...
...
@@ -407,7 +455,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -460,7 +508,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -505,7 +553,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
...
...
@@ -556,7 +604,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
...
...
@@ -604,7 +652,7 @@ End Structure
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
...
...
@@ -635,7 +683,7 @@ End Module
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
...
...
@@ -688,7 +736,7 @@ End Class
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -748,7 +796,7 @@ End Module
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -793,7 +841,7 @@ End Class
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -884,7 +932,7 @@ End Class
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -931,7 +979,7 @@ End Class
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithReferences
(
compilationDef
,
{
MscorlibRef_v4_0_30316_17626
,
MsvbRef_v4_0_30319_17929
},
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithReferences
(
compilationDef
,
{
MscorlibRef_v4_0_30316_17626
,
MsvbRef_v4_0_30319_17929
},
TestOptions
.
ExperimentalReleaseExe
,
parseOptions
:
=
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
>
...
...
@@ -964,7 +1012,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1016,7 +1064,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1047,7 +1095,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1078,7 +1126,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1114,7 +1162,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1147,7 +1195,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1184,7 +1232,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
XmlReferences
,
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1233,7 +1281,7 @@ End Class
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -1284,7 +1332,7 @@ End Class
</
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
Dim
verifier
=
CompileAndVerify
(
compilation
,
expectedOutput
:
=
<
!
[
CDATA
[
...
...
@@ -1341,7 +1389,7 @@ End Class
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
TestOptions
.
Experimental
ReleaseExe
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1406,7 +1454,7 @@ End Module
]]
></
file
>
</
compilation
>
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
{
SystemCoreRef
},
TestOptions
.
ReleaseExe
)
Dim
compilation
=
CompilationUtils
.
CreateCompilationWithMscorlibAndVBRuntime
(
compilationDef
,
{
SystemCoreRef
},
TestOptions
.
ExperimentalReleaseExe
,
TestOptions
.
ExperimentalReleaseExe
.
ParseOptions
)
AssertTheseDiagnostics
(
compilation
,
<
expected
><
!
[
CDATA
[
...
...
@@ -1440,7 +1488,7 @@ End Module
</file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, XmlReferences, TestOptions.
ReleaseExe
)
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, XmlReferences, TestOptions.
ExperimentalReleaseExe, TestOptions.ExperimentalReleaseExe.ParseOptions
)
' TODO: Should succeed
' Dim verifier = CompileAndVerify(compilation, expectedOutput:=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录