Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8b369b41
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,发现更多精彩内容 >>
提交
8b369b41
编写于
10月 05, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add additional location tests.
上级
2512c966
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
48 addition
and
12 deletion
+48
-12
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
+24
-0
src/Compilers/Core/Portable/Compilation/Compilation.cs
src/Compilers/Core/Portable/Compilation/Compilation.cs
+2
-1
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
+22
-11
未找到文件。
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
浏览文件 @
8b369b41
...
...
@@ -4830,6 +4830,8 @@ public void CreateTupleTypeSymbol_WithValueTuple()
Assert.True(tupleWithoutNames.TupleElementNames.IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -4873,6 +4875,8 @@ public void CreateTupleTypeSymbol_NoNames()
Assert.True(tupleWithoutNames.TupleElementNames.IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -4890,6 +4894,8 @@ public void CreateTupleTypeSymbol_WithNames()
Assert.Equal(new[] { "Alice", "Bob" }, tupleWithNames.TupleElementNames);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -4907,6 +4913,8 @@ public void CreateTupleTypeSymbol_WithSomeNames()
Assert.Equal(new[] { null, "Item2", "Charlie" }, tupleWithSomeNames.TupleElementNames);
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32" }, tupleWithSomeNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithSomeNames.Kind);
Assert.All(tupleWithSomeNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -4923,6 +4931,8 @@ public void CreateTupleTypeSymbol_WithBadNames()
Assert.Equal(new[] { "Item2", "Item1" }, tupleWithNames.TupleElementNames);
Assert.Equal(new[] { "System.Int32", "System.Int32" }, tupleWithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -4945,6 +4955,8 @@ public void CreateTupleTypeSymbol_Tuple8NoNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple8WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -4968,6 +4980,8 @@ public void CreateTupleTypeSymbol_Tuple8WithNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple8WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -4991,6 +5005,8 @@ public void CreateTupleTypeSymbol_Tuple9NoNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple9WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -5014,6 +5030,9 @@ public void CreateTupleTypeSymbol_Tuple9WithNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -5040,6 +5059,9 @@ public void CreateTupleTypeSymbol_Tuple9WithDefaultNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.Int32", "System.Int32" },
tuple9WithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
...
...
@@ -5060,6 +5082,8 @@ public void CreateTupleTypeSymbol_ElementTypeIsError()
Assert.Equal(2, types.Length);
Assert.Equal(SymbolKind.NamedType, types[0].Kind);
Assert.Equal(SymbolKind.ErrorType, types[1].Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact, WorkItem(13277, "https://github.com/dotnet/roslyn/issues/13277")]
...
...
src/Compilers/Core/Portable/Compilation/Compilation.cs
浏览文件 @
8b369b41
...
...
@@ -885,7 +885,8 @@ protected static ImmutableArray<string> CheckTupleElementNames(int cardinality,
return
elementNames
;
}
protected
static
void
CheckTupleElementLocations
(
int
cardinality
,
protected
static
void
CheckTupleElementLocations
(
int
cardinality
,
ImmutableArray
<
Location
>
elementLocations
)
{
if
(!
elementLocations
.
IsDefault
)
...
...
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
浏览文件 @
8b369b41
...
...
@@ -5059,7 +5059,8 @@ End Class
Assert
.
True
(
tupleWithoutNames
.
TupleElementNames
.
IsDefault
)
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
},
tupleWithoutNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
Equal
(
SymbolKind
.
NamedType
,
tupleWithoutNames
.
Kind
)
Assert
.
All
(
tupleWithoutNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5107,7 +5108,8 @@ End Class
Assert
.
True
(
tupleWithoutNames
.
TupleElementNames
.
IsDefault
)
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
},
tupleWithoutNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
Equal
(
SymbolKind
.
NamedType
,
tupleWithoutNames
.
Kind
)
Assert
.
All
(
tupleWithoutNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5126,7 +5128,8 @@ End Class
Assert
.
Equal
(
New
String
()
{
"Alice"
,
"Bob"
},
tupleWithoutNames
.
TupleElementNames
)
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
},
tupleWithoutNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
Equal
(
SymbolKind
.
NamedType
,
tupleWithoutNames
.
Kind
)
Assert
.
All
(
tupleWithoutNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5148,7 +5151,8 @@ End Class
tupleWithSomeNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
Equal
(
SymbolKind
.
NamedType
,
tupleWithSomeNames
.
Kind
)
Assert
.
All
(
tupleWithSomeNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5165,7 +5169,8 @@ End Class
Assert
.
Equal
(
New
String
()
{
"Item2"
,
"Item1"
},
tupleWithoutNames
.
TupleElementNames
)
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.Int32"
},
tupleWithoutNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
Equal
(
SymbolKind
.
NamedType
,
tupleWithoutNames
.
Kind
)
Assert
.
All
(
tupleWithoutNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5189,7 +5194,8 @@ End Class
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
},
tuple8WithoutNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
All
(
tuple8WithoutNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5213,7 +5219,8 @@ End Class
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
},
tuple8WithNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
All
(
tuple8WithNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5237,7 +5244,8 @@ End Class
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
},
tuple9WithoutNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
All
(
tuple9WithoutNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5261,7 +5269,8 @@ End Class
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
},
tuple9WithNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
All
(
tuple9WithNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5285,7 +5294,8 @@ End Class
Assert
.
Equal
(
New
String
()
{
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
,
"System.String"
,
"System.Int32"
},
tuple9WithNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
All
(
tuple9WithNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
@@ -5308,7 +5318,8 @@ End Class
Assert
.
Equal
(
2
,
types
.
Length
)
Assert
.
Equal
(
SymbolKind
.
NamedType
,
types
(
0
).
Kind
)
Assert
.
Equal
(
SymbolKind
.
ErrorType
,
types
(
1
).
Kind
)
Assert
.
All
(
tupleWithoutNames
.
GetMembers
().
OfType
(
Of
IFieldSymbol
)().
Select
(
Function
(
f
)
f
.
Locations
.
FirstOrDefault
()),
Sub
(
Loc
)
Assert
.
Equal
(
Loc
,
Nothing
))
End
Sub
<
Fact
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录