Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
32a78766
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,发现更多精彩内容 >>
提交
32a78766
编写于
10月 12, 2016
作者:
A
AlekseyTs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Propagate InvolvesNarrowingFromNumericConstant flag for tuple conversions.
Related to #14255. Fixes #14473.
上级
32b6e80c
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
815 addition
and
25 deletion
+815
-25
src/Compilers/VisualBasic/Portable/Binding/Binder_Conversions.vb
...pilers/VisualBasic/Portable/Binding/Binder_Conversions.vb
+2
-2
src/Compilers/VisualBasic/Portable/Lowering/ExpressionLambdaRewriter/ExpressionLambdaRewriter_ConditionalExpresion.vb
...Rewriter/ExpressionLambdaRewriter_ConditionalExpresion.vb
+2
-2
src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.vb
...rtable/Lowering/LocalRewriter/LocalRewriter_Conversion.vb
+2
-3
src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_InterpolatedString.vb
...owering/LocalRewriter/LocalRewriter_InterpolatedString.vb
+1
-1
src/Compilers/VisualBasic/Portable/Semantics/Conversions.vb
src/Compilers/VisualBasic/Portable/Semantics/Conversions.vb
+7
-1
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
+801
-16
未找到文件。
src/Compilers/VisualBasic/Portable/Binding/Binder_Conversions.vb
浏览文件 @
32a78766
...
@@ -1560,7 +1560,7 @@ DoneWithDiagnostics:
...
@@ -1560,7 +1560,7 @@ DoneWithDiagnostics:
Private
Function
ReclassifyInterpolatedStringExpression
(
conversionSemantics
As
SyntaxKind
,
tree
As
SyntaxNode
,
convKind
As
ConversionKind
,
isExplicit
As
Boolean
,
node
As
BoundInterpolatedStringExpression
,
targetType
As
TypeSymbol
,
diagnostics
As
DiagnosticBag
)
As
BoundExpression
Private
Function
ReclassifyInterpolatedStringExpression
(
conversionSemantics
As
SyntaxKind
,
tree
As
SyntaxNode
,
convKind
As
ConversionKind
,
isExplicit
As
Boolean
,
node
As
BoundInterpolatedStringExpression
,
targetType
As
TypeSymbol
,
diagnostics
As
DiagnosticBag
)
As
BoundExpression
If
convKind
=
ConversionKind
.
InterpolatedString
Then
If
(
convKind
And
ConversionKind
.
InterpolatedString
)
=
ConversionKind
.
InterpolatedString
Then
Debug
.
Assert
(
targetType
.
Equals
(
Compilation
.
GetWellKnownType
(
WellKnownType
.
System_IFormattable
))
OrElse
targetType
.
Equals
(
Compilation
.
GetWellKnownType
(
WellKnownType
.
System_FormattableString
)))
Debug
.
Assert
(
targetType
.
Equals
(
Compilation
.
GetWellKnownType
(
WellKnownType
.
System_IFormattable
))
OrElse
targetType
.
Equals
(
Compilation
.
GetWellKnownType
(
WellKnownType
.
System_FormattableString
)))
Return
New
BoundConversion
(
tree
,
node
,
ConversionKind
.
InterpolatedString
,
False
,
isExplicit
,
targetType
)
Return
New
BoundConversion
(
tree
,
node
,
ConversionKind
.
InterpolatedString
,
False
,
isExplicit
,
targetType
)
End
If
End
If
...
@@ -1579,7 +1579,7 @@ DoneWithDiagnostics:
...
@@ -1579,7 +1579,7 @@ DoneWithDiagnostics:
' We have a successful tuple conversion rather than producing a separate conversion node
' We have a successful tuple conversion rather than producing a separate conversion node
' which is a conversion on top of a tuple literal, tuple conversion is an element-wise conversion of arguments.
' which is a conversion on top of a tuple literal, tuple conversion is an element-wise conversion of arguments.
Dim
isNullableTupleConversion
=
(
convKind
=
ConversionKind
.
WideningNullable
)
Or
(
convKind
=
ConversionKind
.
NarrowingNullable
)
Dim
isNullableTupleConversion
=
(
convKind
And
ConversionKind
.
Nullable
)
<>
0
Debug
.
Assert
(
Not
isNullableTupleConversion
OrElse
destination
.
IsNullableType
())
Debug
.
Assert
(
Not
isNullableTupleConversion
OrElse
destination
.
IsNullableType
())
Dim
targetType
=
destination
Dim
targetType
=
destination
...
...
src/Compilers/VisualBasic/Portable/Lowering/ExpressionLambdaRewriter/ExpressionLambdaRewriter_ConditionalExpresion.vb
浏览文件 @
32a78766
...
@@ -105,7 +105,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
...
@@ -105,7 +105,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim
convKind
As
ConversionKind
=
Conversions
.
ClassifyPredefinedConversion
(
parameterType
,
conversion
.
Operand
.
Type
,
useSiteDiagnostics
)
Dim
convKind
As
ConversionKind
=
Conversions
.
ClassifyPredefinedConversion
(
parameterType
,
conversion
.
Operand
.
Type
,
useSiteDiagnostics
)
Diagnostics
.
Add
(
conversion
,
useSiteDiagnostics
)
Diagnostics
.
Add
(
conversion
,
useSiteDiagnostics
)
If
convKind
=
ConversionKind
.
NarrowingNullable
AndAlso
Not
toType
.
IsNullableType
Then
If
(
convKind
And
ConversionKind
.
NarrowingNullable
)
=
ConversionKind
.
NarrowingNullable
AndAlso
Not
toType
.
IsNullableType
Then
' Convert to non-nullable type first to mimic Dev11
' Convert to non-nullable type first to mimic Dev11
Return
Me
.
_factory
.
Convert
(
toType
,
CreateUserDefinedNullableToUnderlyingConversion
(
parameter
,
parameterType
,
isChecked
),
isChecked
)
Return
Me
.
_factory
.
Convert
(
toType
,
CreateUserDefinedNullableToUnderlyingConversion
(
parameter
,
parameterType
,
isChecked
),
isChecked
)
Else
Else
...
@@ -200,7 +200,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
...
@@ -200,7 +200,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim
innerConversionApplied
As
Boolean
=
Not
Conversions
.
IsIdentityConversion
(
innerConversion
)
Dim
innerConversionApplied
As
Boolean
=
Not
Conversions
.
IsIdentityConversion
(
innerConversion
)
If
innerConversionApplied
Then
If
innerConversionApplied
Then
Debug
.
Assert
(
innerConversion
=
ConversionKind
.
NarrowingNullable
)
Debug
.
Assert
(
(
innerConversion
And
ConversionKind
.
NarrowingNullable
)
=
ConversionKind
.
NarrowingNullable
)
'If outConv Is Nothing OrElse outConv.ConversionKind = ConversionKind.WideningNullable Then
'If outConv Is Nothing OrElse outConv.ConversionKind = ConversionKind.WideningNullable Then
' NOTE: in simple cases where inner conversion is (T? -> T) and outer conversion is (S -> S?),
' NOTE: in simple cases where inner conversion is (T? -> T) and outer conversion is (S -> S?),
...
...
src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.vb
浏览文件 @
32a78766
...
@@ -98,11 +98,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
...
@@ -98,11 +98,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
If
node
.
RelaxationLambdaOpt
IsNot
Nothing
Then
If
node
.
RelaxationLambdaOpt
IsNot
Nothing
Then
returnValue
=
RewriteLambdaRelaxationConversion
(
node
)
returnValue
=
RewriteLambdaRelaxationConversion
(
node
)
ElseIf
node
.
ConversionKind
=
ConversionKind
.
InterpolatedString
Then
ElseIf
(
node
.
ConversionKind
And
ConversionKind
.
InterpolatedString
)
=
ConversionKind
.
InterpolatedString
Then
returnValue
=
RewriteInterpolatedStringConversion
(
node
)
returnValue
=
RewriteInterpolatedStringConversion
(
node
)
ElseIf
node
.
ConversionKind
=
ConversionKind
.
WideningTuple
OrElse
ElseIf
(
node
.
ConversionKind
And
ConversionKind
.
Tuple
)
<>
0
Then
node
.
ConversionKind
=
ConversionKind
.
NarrowingTuple
Then
returnValue
=
RewriteTupleConversion
(
node
)
returnValue
=
RewriteTupleConversion
(
node
)
Else
Else
...
...
src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_InterpolatedString.vb
浏览文件 @
32a78766
...
@@ -50,7 +50,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
...
@@ -50,7 +50,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private
Function
RewriteInterpolatedStringConversion
(
conversion
As
BoundConversion
)
As
BoundExpression
Private
Function
RewriteInterpolatedStringConversion
(
conversion
As
BoundConversion
)
As
BoundExpression
Debug
.
Assert
(
conversion
.
ConversionKind
=
ConversionKind
.
InterpolatedString
)
Debug
.
Assert
(
(
conversion
.
ConversionKind
And
ConversionKind
.
InterpolatedString
)
=
ConversionKind
.
InterpolatedString
)
Dim
targetType
=
conversion
.
Type
Dim
targetType
=
conversion
.
Type
Dim
node
=
DirectCast
(
conversion
.
Operand
,
BoundInterpolatedStringExpression
)
Dim
node
=
DirectCast
(
conversion
.
Operand
,
BoundInterpolatedStringExpression
)
...
...
src/Compilers/VisualBasic/Portable/Semantics/Conversions.vb
浏览文件 @
32a78766
...
@@ -1246,6 +1246,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
...
@@ -1246,6 +1246,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
' check arguments against flattened list of target element types
' check arguments against flattened list of target element types
Dim
result
As
ConversionKind
=
wideningConversion
Dim
result
As
ConversionKind
=
wideningConversion
Dim
involvesNarrowingFromNumericConstant
As
ConversionKind
=
Nothing
Dim
allNarrowingIsFromNumericConstant
=
ConversionKind
.
InvolvesNarrowingFromNumericConstant
For
i
As
Integer
=
0
To
arguments
.
Length
-
1
For
i
As
Integer
=
0
To
arguments
.
Length
-
1
Dim
argument
=
arguments
(
i
)
Dim
argument
=
arguments
(
i
)
...
@@ -1261,12 +1263,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
...
@@ -1261,12 +1263,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
Nothing
'ConversionKind.NoConversion
Return
Nothing
'ConversionKind.NoConversion
End
If
End
If
involvesNarrowingFromNumericConstant
=
involvesNarrowingFromNumericConstant
Or
elementConversion
If
IsNarrowingConversion
(
elementConversion
)
Then
If
IsNarrowingConversion
(
elementConversion
)
Then
allNarrowingIsFromNumericConstant
=
allNarrowingIsFromNumericConstant
And
elementConversion
result
=
narrowingConversion
result
=
narrowingConversion
End
If
End
If
Next
Next
Return
result
Return
result
Or
(
involvesNarrowingFromNumericConstant
And
allNarrowingIsFromNumericConstant
And
ConversionKind
.
InvolvesNarrowingFromNumericConstant
)
End
Function
End
Function
Private
Shared
Function
ClassifyArrayInitialization
(
source
As
BoundArrayInitialization
,
targetElementType
As
TypeSymbol
,
binder
As
Binder
,
<
[
In
]
,
Out
>
ByRef
useSiteDiagnostics
As
HashSet
(
Of
DiagnosticInfo
))
As
ConversionKind
Private
Shared
Function
ClassifyArrayInitialization
(
source
As
BoundArrayInitialization
,
targetElementType
As
TypeSymbol
,
binder
As
Binder
,
<
[
In
]
,
Out
>
ByRef
useSiteDiagnostics
As
HashSet
(
Of
DiagnosticInfo
))
As
ConversionKind
...
...
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
浏览文件 @
32a78766
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录