Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
932e0f15
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 搜索 >>
未验证
提交
932e0f15
编写于
12月 18, 2020
作者:
J
Julien Couvreur
提交者:
GitHub
12月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid AmbigMember in lookup of interfaces with nullability differences only (#49338)
上级
9c1151af
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
855 addition
and
43 deletion
+855
-43
src/Compilers/CSharp/Portable/Binder/Binder_Lookup.cs
src/Compilers/CSharp/Portable/Binder/Binder_Lookup.cs
+13
-4
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
...rp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
+838
-30
src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs
...est/Symbol/Symbols/DefaultInterfaceImplementationTests.cs
+1
-7
src/Compilers/Test/Utilities/CSharp/SymbolUtilities.cs
src/Compilers/Test/Utilities/CSharp/SymbolUtilities.cs
+3
-2
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Lookup.cs
浏览文件 @
932e0f15
...
...
@@ -1058,11 +1058,20 @@ static void addAllInterfaces(NamedTypeSymbol @interface, HashSet<NamedTypeSymbol
if
(
interfaces
.
Length
>
0
)
{
var
tmp
=
LookupResult
.
GetInstance
();
foreach
(
TypeSymbol
baseInterface
in
interfaces
)
HashSet
<
NamedTypeSymbol
>
seenInterfaces
=
null
;
if
(
interfaces
.
Length
>
1
)
{
LookupMembersWithoutInheritance
(
tmp
,
baseInterface
,
name
,
arity
,
options
,
originalBinder
,
accessThroughType
,
diagnose
,
ref
useSiteDiagnostics
,
basesBeingResolved
);
MergeHidingLookupResults
(
current
,
tmp
,
basesBeingResolved
,
ref
useSiteDiagnostics
);
tmp
.
Clear
();
seenInterfaces
=
new
HashSet
<
NamedTypeSymbol
>(
Symbols
.
SymbolEqualityComparer
.
IgnoringNullable
);
}
foreach
(
NamedTypeSymbol
baseInterface
in
interfaces
)
{
if
(
seenInterfaces
is
null
||
seenInterfaces
.
Add
(
baseInterface
))
{
LookupMembersWithoutInheritance
(
tmp
,
baseInterface
,
name
,
arity
,
options
,
originalBinder
,
accessThroughType
,
diagnose
,
ref
useSiteDiagnostics
,
basesBeingResolved
);
MergeHidingLookupResults
(
current
,
tmp
,
basesBeingResolved
,
ref
useSiteDiagnostics
);
tmp
.
Clear
();
}
}
tmp
.
Free
();
}
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
浏览文件 @
932e0f15
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs
浏览文件 @
932e0f15
...
...
@@ -57708,13 +57708,7 @@ interface D : A.E
compilation1.VerifyDiagnostics(
// (4,11): warning CS8645: 'C<object>' is already listed in the interface list on type 'A' with different nullability of reference types.
// interface A : B, C<object>
Diagnostic(ErrorCode.WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList, "A").WithArguments("C<object>", "A").WithLocation(4, 11),
// (18,17): error CS0104: 'E' is an ambiguous reference between 'C<object?>.E' and 'C<object>.E'
// interface D : A.E
Diagnostic(ErrorCode.ERR_AmbigContext, "E").WithArguments("E", "C<object?>.E", "C<object>.E").WithLocation(18, 17),
// (20,7): error CS0104: 'E' is an ambiguous reference between 'C<object?>.E' and 'C<object>.E'
// A.E Test();
Diagnostic(ErrorCode.ERR_AmbigContext, "E").WithArguments("E", "C<object?>.E", "C<object>.E").WithLocation(20, 7)
Diagnostic(ErrorCode.WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList, "A").WithArguments("C<object>", "A").WithLocation(4, 11)
);
}
src/Compilers/Test/Utilities/CSharp/SymbolUtilities.cs
浏览文件 @
932e0f15
...
...
@@ -118,9 +118,10 @@ public static string[] ToTestDisplayStrings(this IEnumerable<ISymbol> symbols)
return
symbols
.
Select
(
s
=>
s
.
ToTestDisplayString
()).
ToArray
();
}
public
static
string
[]
ToTestDisplayStrings
(
this
IEnumerable
<
Symbol
>
symbols
)
public
static
string
[]
ToTestDisplayStrings
(
this
IEnumerable
<
Symbol
>
symbols
,
SymbolDisplayFormat
format
=
null
)
{
return
symbols
.
Select
(
s
=>
s
.
ToTestDisplayString
()).
ToArray
();
format
??=
SymbolDisplayFormat
.
TestFormat
;
return
symbols
.
Select
(
s
=>
s
.
ToDisplayString
(
format
)).
ToArray
();
}
public
static
string
ToTestDisplayString
(
this
ISymbol
symbol
,
bool
includeNonNullable
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录