Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
fd533406
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
fd533406
编写于
9月 30, 2020
作者:
M
msftbot[bot]
提交者:
GitHub
9月 30, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #48191 from dotnet/merges/release/dev16.8-to-master
Merge release/dev16.8 to master
上级
3d5b7f8d
1c155c59
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
292 addition
and
17 deletion
+292
-17
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs
.../Portable/Binder/Semantics/Conversions/ConversionsBase.cs
+17
-8
src/Compilers/CSharp/Portable/Symbols/Source/TypeParameterConstraintClause.cs
.../Portable/Symbols/Source/TypeParameterConstraintClause.cs
+2
-2
src/Compilers/CSharp/Portable/Symbols/TypeParameterBounds.cs
src/Compilers/CSharp/Portable/Symbols/TypeParameterBounds.cs
+2
-2
src/Compilers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs
...lers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs
+271
-5
未找到文件。
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs
浏览文件 @
fd533406
...
...
@@ -1220,6 +1220,7 @@ private Conversion ClassifyExplicitOnlyConversionFromExpression(BoundExpression
return
GetExplicitUserDefinedConversion
(
sourceExpression
,
sourceType
,
destination
,
ref
useSiteDiagnostics
);
}
#
nullable
enable
private
static
bool
HasImplicitEnumerationConversion
(
BoundExpression
source
,
TypeSymbol
destination
)
{
Debug
.
Assert
((
object
)
source
!=
null
);
...
...
@@ -1241,9 +1242,11 @@ private static bool HasImplicitEnumerationConversion(BoundExpression source, Typ
var
sourceConstantValue
=
source
.
ConstantValue
;
return
sourceConstantValue
!=
null
&&
IsNumericType
(
source
.
Type
.
GetSpecialTypeSafe
())
&&
source
.
Type
is
object
&&
IsNumericType
(
source
.
Type
)
&&
IsConstantNumericZero
(
sourceConstantValue
);
}
#
nullable
disable
private
static
LambdaConversionResult
IsAnonymousFunctionCompatibleWithDelegate
(
UnboundLambda
anonymousFunction
,
TypeSymbol
type
)
{
...
...
@@ -1787,6 +1790,7 @@ private static int GetNumericTypeIndex(SpecialType specialType)
}
}
#
nullable
enable
private
static
bool
HasImplicitNumericConversion
(
TypeSymbol
source
,
TypeSymbol
destination
)
{
Debug
.
Assert
((
object
)
source
!=
null
);
...
...
@@ -1829,7 +1833,7 @@ private static bool HasExplicitNumericConversion(TypeSymbol source, TypeSymbol d
return
s_explicitNumericConversions
[
sourceIndex
,
destinationIndex
];
}
p
ublic
static
bool
IsConstantNumericZero
(
ConstantValue
value
)
p
rivate
static
bool
IsConstantNumericZero
(
ConstantValue
value
)
{
switch
(
value
.
Discriminator
)
{
...
...
@@ -1840,12 +1844,14 @@ public static bool IsConstantNumericZero(ConstantValue value)
case
ConstantValueTypeDiscriminator
.
Int16
:
return
value
.
Int16Value
==
0
;
case
ConstantValueTypeDiscriminator
.
Int32
:
case
ConstantValueTypeDiscriminator
.
NInt
:
return
value
.
Int32Value
==
0
;
case
ConstantValueTypeDiscriminator
.
Int64
:
return
value
.
Int64Value
==
0
;
case
ConstantValueTypeDiscriminator
.
UInt16
:
return
value
.
UInt16Value
==
0
;
case
ConstantValueTypeDiscriminator
.
UInt32
:
case
ConstantValueTypeDiscriminator
.
NUInt
:
return
value
.
UInt32Value
==
0
;
case
ConstantValueTypeDiscriminator
.
UInt64
:
return
value
.
UInt64Value
==
0
;
...
...
@@ -1858,9 +1864,9 @@ public static bool IsConstantNumericZero(ConstantValue value)
return
false
;
}
p
ublic
static
bool
IsNumericType
(
SpecialType
specialT
ype
)
p
rivate
static
bool
IsNumericType
(
TypeSymbol
t
ype
)
{
switch
(
s
pecialType
)
switch
(
type
.
S
pecialType
)
{
case
SpecialType
.
System_Char
:
case
SpecialType
.
System_SByte
:
...
...
@@ -1874,6 +1880,8 @@ public static bool IsNumericType(SpecialType specialType)
case
SpecialType
.
System_Single
:
case
SpecialType
.
System_Double
:
case
SpecialType
.
System_Decimal
:
case
SpecialType
.
System_IntPtr
when
type
.
IsNativeIntegerType
:
case
SpecialType
.
System_UIntPtr
when
type
.
IsNativeIntegerType
:
return
true
;
default
:
return
false
;
...
...
@@ -1972,16 +1980,16 @@ private static bool HasExplicitEnumerationConversion(TypeSymbol source, TypeSymb
Debug
.
Assert
((
object
)
destination
!=
null
);
// SPEC: The explicit enumeration conversions are:
// SPEC: From sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, or decimal to any enum-type.
// SPEC: From any enum-type to sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, or decimal.
// SPEC: From sbyte, byte, short, ushort, int, uint, long, ulong,
nint, nuint,
char, float, double, or decimal to any enum-type.
// SPEC: From any enum-type to sbyte, byte, short, ushort, int, uint, long, ulong,
nint, nuint,
char, float, double, or decimal.
// SPEC: From any enum-type to any other enum-type.
if
(
IsNumericType
(
source
.
SpecialType
)
&&
destination
.
IsEnumType
())
if
(
IsNumericType
(
source
)
&&
destination
.
IsEnumType
())
{
return
true
;
}
if
(
IsNumericType
(
destination
.
SpecialType
)
&&
source
.
IsEnumType
())
if
(
IsNumericType
(
destination
)
&&
source
.
IsEnumType
())
{
return
true
;
}
...
...
@@ -1993,6 +2001,7 @@ private static bool HasExplicitEnumerationConversion(TypeSymbol source, TypeSymb
return
false
;
}
#
nullable
disable
private
Conversion
ClassifyImplicitNullableConversion
(
TypeSymbol
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
)
{
...
...
src/Compilers/CSharp/Portable/Symbols/Source/TypeParameterConstraintClause.cs
浏览文件 @
fd533406
...
...
@@ -240,8 +240,8 @@ internal static bool ContainsOnlyEmptyConstraintClauses(this ImmutableArray<Type
}
// Returns true if constraintClauses was updated with value.
// Returns false if constraintClauses already had a value with
expected
'IgnoresNullableContext'
// or was updated to a value with
the expected 'IgnoresNullableContext' value
on another thread.
// Returns false if constraintClauses already had a value with
sufficient
'IgnoresNullableContext'
// or was updated to a value with
sufficient 'IgnoresNullableContext'
on another thread.
internal
static
bool
InterlockedUpdate
(
ref
ImmutableArray
<
TypeParameterConstraintClause
>
constraintClauses
,
ImmutableArray
<
TypeParameterConstraintClause
>
value
)
{
bool
canIgnoreNullableContext
=
value
.
IgnoresNullableContext
();
...
...
src/Compilers/CSharp/Portable/Symbols/TypeParameterBounds.cs
浏览文件 @
fd533406
...
...
@@ -96,8 +96,8 @@ internal static bool HasValue(this TypeParameterBounds? boundsOpt, bool canIgnor
}
// Returns true if bounds was updated with value.
// Returns false if bounds already had a value with
expected
'IgnoresNullableContext'
// or was updated to a value with
the expected 'IgnoresNullableContext' value
on another thread.
// Returns false if bounds already had a value with
sufficient
'IgnoresNullableContext'
// or was updated to a value with
sufficient 'IgnoresNullableContext'
on another thread.
internal
static
bool
InterlockedUpdate
(
ref
TypeParameterBounds
?
bounds
,
TypeParameterBounds
?
value
)
{
bool
canIgnoreNullableContext
=
(
value
?.
IgnoresNullableContext
==
true
);
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs
浏览文件 @
fd533406
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录