Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
7625b6e1
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,发现更多精彩内容 >>
提交
7625b6e1
编写于
9月 16, 2016
作者:
J
Julien
提交者:
GitHub
9月 16, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding tests to close #13661 and #12802 (#13851)
上级
f5ff9ae8
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
111 addition
and
0 deletion
+111
-0
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
+35
-0
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
+34
-0
src/EditorFeatures/CSharpTest/CodeActions/InlineTemporary/InlineTemporaryTests.cs
...pTest/CodeActions/InlineTemporary/InlineTemporaryTests.cs
+42
-0
未找到文件。
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
浏览文件 @
7625b6e1
...
@@ -18098,5 +18098,40 @@ static void Main()
...
@@ -18098,5 +18098,40 @@ static void Main()
});
});
// no assertion in MetadataWriter
// no assertion in MetadataWriter
}
}
[Fact]
[WorkItem(13661, "https://github.com/dotnet/roslyn/issues/13661")]
public void LongTupleWithPartialNames_Bug13661()
{
var source = @"
using System;
class C
{
static void Main()
{
var o = (A: 1, 2, C: 3, D: 4, E: 5, F: 6, G: 7, 8, I: 9);
Console.Write(o.I);
}
}
";
CompileAndVerify(source,
additionalRefs: s_valueTupleRefs,
options: TestOptions.DebugExe,
expectedOutput: @"9",
sourceSymbolValidator: (module) =>
{
var sourceModule = (SourceModuleSymbol)module;
var compilation = sourceModule.DeclaringCompilation;
var tree = compilation.SyntaxTrees.First();
var model = compilation.GetSemanticModel(tree);
var nodes = tree.GetCompilationUnitRoot().DescendantNodes();
var x = nodes.OfType<VariableDeclaratorSyntax>().First();
var xSymbol = ((SourceLocalSymbol)model.GetDeclaredSymbol(x)).Type;
AssertEx.SetEqual(xSymbol.GetMembers().OfType<FieldSymbol>().Select(f => f.Name),
"A", "C", "D", "E", "F", "G", "I", "Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Rest");
});
// no assert hit
}
}
}
}
}
\ No newline at end of file
src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
浏览文件 @
7625b6e1
...
@@ -8198,6 +8198,40 @@ End Module
...
@@ -8198,6 +8198,40 @@ End Module
End
Sub
End
Sub
<
Fact
>
<
WorkItem
(
13661
,
"https://github.com/dotnet/roslyn/issues/13661"
)
>
Public
Sub
LongTupleWithPartialNames_Bug13661
()
Dim
verifier
=
CompileAndVerify
(
<
compilation
>
<
file
name
=
"a.vb"
>
Module
C
Sub
Main
()
Dim
t
=
(
A
:
=
1
,
2
,
C
:
=
3
,
D
:
=
4
,
E
:
=
5
,
F
:
=
6
,
G
:
=
7
,
8
,
I
:
=
9
)
System
.
Console
.
Write
(
$
"{t.I}"
)
End
Sub
End
Module
</
file
>
</
compilation
>
,
additionalRefs
:
=
{
ValueTupleRef
,
SystemRuntimeFacadeRef
},
options
:
=
TestOptions
.
DebugExe
,
expectedOutput
:
=
"9"
,
sourceSymbolValidator
:
=
Sub
(
m
As
ModuleSymbol
)
Dim
compilation
=
m
.
DeclaringCompilation
Dim
tree
=
compilation
.
SyntaxTrees
.
First
()
Dim
model
=
compilation
.
GetSemanticModel
(
tree
)
Dim
nodes
=
tree
.
GetCompilationUnitRoot
().
DescendantNodes
()
Dim
t
=
nodes
.
OfType
(
Of
VariableDeclaratorSyntax
)().
Single
().
Names
(
0
)
Dim
xSymbol
=
DirectCast
(
model
.
GetDeclaredSymbol
(
t
),
LocalSymbol
).
Type
AssertEx
.
SetEqual
(
xSymbol
.
GetMembers
().
OfType
(
Of
FieldSymbol
)().
Select
(
Function
(
f
)
f
.
Name
),
"A"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"I"
,
"Item1"
,
"Item2"
,
"Item3"
,
"Item4"
,
"Item5"
,
"Item6"
,
"Item7"
,
"Item8"
,
"Item9"
,
"Rest"
)
End
Sub
)
' No assert hit
End
Sub
End
Class
End
Class
End
Namespace
End
Namespace
...
...
src/EditorFeatures/CSharpTest/CodeActions/InlineTemporary/InlineTemporaryTests.cs
浏览文件 @
7625b6e1
...
@@ -4071,5 +4071,47 @@ public void M()
...
@@ -4071,5 +4071,47 @@ public void M()
await
TestAsync
(
code
,
expected
,
index
:
0
);
await
TestAsync
(
code
,
expected
,
index
:
0
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsInlineTemporary
)]
[
WorkItem
(
12802
,
"https://github.com/dotnet/roslyn/issues/12802"
)]
public
async
Task
Deconstruction2
()
{
var
code
=
@"
class Program
{
static void Main()
{
var [||]kvp = KVP.Create(42, ""hello"");
var(x1, x2) = kvp;
}
}
public static class KVP
{
public static KVP<T1, T2> Create<T1, T2>(T1 item1, T2 item2) { return null; }
}
public class KVP<T1, T2>
{
public void Deconstruct(out T1 item1, out T2 item2) { item1 = default(T1); item2 = default(T2); }
}"
;
var
expected
=
@"
class Program
{
static void Main()
{
var(x1, x2) = KVP.Create(42, ""hello"");
}
}
public static class KVP
{
public static KVP<T1, T2> Create<T1, T2>(T1 item1, T2 item2) { return null; }
}
public class KVP<T1, T2>
{
public void Deconstruct(out T1 item1, out T2 item2) { item1 = default(T1); item2 = default(T2); }
}"
;
await
TestAsync
(
code
,
expected
,
index
:
0
);
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录