Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
aff88fad
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,发现更多精彩内容 >>
提交
aff88fad
编写于
11月 03, 2016
作者:
C
Charles Stoner
提交者:
GitHub
11月 03, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14912 from cston/10861-2
Test Tuples and SymbolDisplay.ToMinimalDisplayParts
上级
f6ff3b9a
075d540e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
12 deletion
+48
-12
src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs
...rs/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs
+22
-4
src/Compilers/VisualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb
...sualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb
+26
-8
未找到文件。
src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs
浏览文件 @
aff88fad
...
...
@@ -4675,25 +4675,27 @@ class C
}
[
Fact
,
CompilerTrait
(
CompilerFeature
.
Tuples
)]
public
void
Tuple
FullyQualified
()
public
void
Tuple
QualifiedNames
()
{
var
text
=
@"using N;
@"using N
AB = N.A.B
;
namespace N
{
class A
{
internal class B {
}
internal class B {}
}
class C<T>
{
// offset 1
}
}
class C
{
#pragma warning disable CS0169
(int One,
C<(object[], A.B Two)>, int, object Four, int, object, int, object,
A Nine) f;
(int One,
N.C<(object[], NAB Two)>, int, object Four, int, object, int, object, N.
A Nine) f;
#pragma warning restore CS0169
// offset 2
}"
;
var
format
=
new
SymbolDisplayFormat
(
globalNamespaceStyle
:
SymbolDisplayGlobalNamespaceStyle
.
Included
,
...
...
@@ -4704,9 +4706,25 @@ class C
var
comp
=
CreateCompilationWithMscorlib
(
text
,
references
:
new
[]
{
ValueTupleRef
});
comp
.
VerifyDiagnostics
();
var
symbol
=
comp
.
GetMember
(
"C.f"
);
// Fully qualified format.
Verify
(
SymbolDisplay
.
ToDisplayParts
(
symbol
,
format
),
"(int One, global::N.C<(object[], global::N.A.B Two)>, int, object Four, int, object, int, object, global::N.A Nine) f"
);
// Minimally qualified format.
Verify
(
SymbolDisplay
.
ToDisplayParts
(
symbol
,
SymbolDisplayFormat
.
MinimallyQualifiedFormat
),
"(int One, C<(object[], B Two)>, int, object Four, int, object, int, object, A Nine) C.f"
);
// ToMinimalDisplayParts.
var
model
=
comp
.
GetSemanticModel
(
comp
.
SyntaxTrees
[
0
]);
Verify
(
SymbolDisplay
.
ToMinimalDisplayParts
(
symbol
,
model
,
text
.
IndexOf
(
"offset 1"
),
format
),
"(int One, C<(object[], NAB Two)>, int, object Four, int, object, int, object, A Nine) f"
);
Verify
(
SymbolDisplay
.
ToMinimalDisplayParts
(
symbol
,
model
,
text
.
IndexOf
(
"offset 2"
),
format
),
"(int One, N.C<(object[], NAB Two)>, int, object Four, int, object, int, object, N.A Nine) f"
);
}
/// <summary>
...
...
src/Compilers/VisualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb
浏览文件 @
aff88fad
...
...
@@ -4792,23 +4792,25 @@ End Class
End
Sub
<
Fact
()
>
Public
Sub
TupleFullyQualified
()
Dim
source
=
<
compilation
>
<
file
name
=
"a.vb"
>
Imports
N
Public
Sub
TupleQualifiedNames
()
Dim
text
=
"Imports NAB = N.A.B
Namespace N
Class A
Friend Class B
End Class
End Class
Class C(Of T)
' offset 1
End Class
End Namespace
Class C
Private
f
As
(
One
As
Integer
,
C
(
Of
(
Object
(),
Two
As
A
.
B
)),
Integer
,
Four
As
Object
,
Integer
,
Object
,
Integer
,
Object
,
Nine
As
A
)
End
Class
</
file
>
Private f As (One As Integer, N.C(Of (Object(), Two As NAB)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As N.A)
' offset 2
End Class"
Dim
source
=
<
compilation
>
<
file
name
=
"a.vb"
><
%
=
text
%
></
file
>
</
compilation
>
Dim
format
=
New
SymbolDisplayFormat
(
globalNamespaceStyle
:
=
SymbolDisplayGlobalNamespaceStyle
.
Included
,
...
...
@@ -4819,9 +4821,25 @@ End Class
Dim
comp
=
CompilationUtils
.
CreateCompilationWithMscorlib
(
source
,
references
:
=
{
ValueTupleRef
})
comp
.
VerifyDiagnostics
()
Dim
symbol
=
comp
.
GetMember
(
"C.f"
)
' Fully qualified format.
Verify
(
SymbolDisplay
.
ToDisplayParts
(
symbol
,
format
),
"f As (One As Integer, Global.N.C(Of (Object(), Two As Global.N.A.B)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As Global.N.A)"
)
' Minimally qualified format.
Verify
(
SymbolDisplay
.
ToDisplayParts
(
symbol
,
SymbolDisplayFormat
.
MinimallyQualifiedFormat
),
"C.f As (One As Integer, C(Of (Object(), Two As B)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As A)"
)
' ToMinimalDisplayParts.
Dim
model
=
comp
.
GetSemanticModel
(
comp
.
SyntaxTrees
(
0
))
Verify
(
SymbolDisplay
.
ToMinimalDisplayParts
(
symbol
,
model
,
text
.
IndexOf
(
"offset 1"
),
format
),
"f As (One As Integer, C(Of (Object(), Two As NAB)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As A)"
)
Verify
(
SymbolDisplay
.
ToMinimalDisplayParts
(
symbol
,
model
,
text
.
IndexOf
(
"offset 2"
),
format
),
"f As (One As Integer, N.C(Of (Object(), Two As NAB)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As N.A)"
)
End
Sub
' A tuple type symbol that is not Microsoft.CodeAnalysis.VisualBasic.Symbols.TupleTypeSymbol.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录