Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit-tests. #43604

Merged
merged 1 commit into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27087,5 +27087,32 @@ .locals init (C.<>c__DisplayClass0_0 V_0, //CS$<>8__locals0
}
");
}

[Fact]
[WorkItem(24517, "https://github.com/dotnet/roslyn/issues/24517")]
public void Issue24517()
{
var source = @"
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
class C
{
static void Main()
{
Expression<Func<ValueTuple<int, int>>> e1 = () => new ValueTuple<int, int>(1, 2);
Expression<Func<KeyValuePair<int, int>>> e2 = () => new KeyValuePair<int, int>(1, 2);

e1.Compile()();
e2.Compile()();

Console.WriteLine(""Done."");
}
}";
var comp = CreateCompilation(
source,
options: TestOptions.ReleaseExe);
CompileAndVerify(comp, expectedOutput: @"Done.");
}
}
}
27 changes: 27 additions & 0 deletions src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23084,6 +23084,33 @@ Module Module1
System.Console.WriteLine(""Done"")
End Sub

End Module
"

Dim comp1 = CreateCompilation(source0, options:=TestOptions.DebugExe)
CompileAndVerify(comp1, expectedOutput:="Done")
End Sub

<Fact>
<WorkItem(24517, "https://github.com/dotnet/roslyn/issues/24517")>
Public Sub Issue24517()
Dim source0 = "
Imports System
Imports System.Collections.Generic
Imports System.Linq.Expressions

Module Module1

Sub Main()
Dim e1 As Expression(Of Func(Of ValueTuple(Of Integer, Integer))) = Function() new ValueTuple(Of Integer, Integer)(1, 2)
Dim e2 As Expression(Of Func(Of KeyValuePair(Of Integer, Integer))) = Function() new KeyValuePair(Of Integer, Integer)(1, 2)

e1.Compile()()
e2.Compile()()

System.Console.WriteLine(""Done"")
End Sub

End Module
"

Expand Down