The generated code below is un-necessarily complicated. Dustin suggested to track an issue for the simplifier.
Note: it may be better to wait for the tuple conversion work which Vlad will do next week, as it might make the problem easier.
public async Task TuplesWithDifferentNames()
{
var code = @"
class C
{
public void M()
{
(int a, string b) [||]x = (c: 1, d: ""hello"");
x.a.ToString();
}
}";
var expected = @"
class C
{
public void M()
{
(((int a, string b))((c: (int)1, d: (string)""hello""))).a.ToString();
}
}";
await TestAsync(code, expected, index: 0, compareTokens: false, parseOptions: TestOptions.Regular.WithTuplesFeature());
}
File is InlineTemporaryTests.cs.
There are some other refactorings which may be improved by this simplification. They print code like default((string c, int d)). See TestTupleOptionalWithNames in AddConstructorParametersTests.cs, and TupleWithNames_Equals and TupleWithNames_HashCode in GenerateEqualsAndGetHashCodeTests.cs
The generated code below is un-necessarily complicated. Dustin suggested to track an issue for the simplifier.
Note: it may be better to wait for the tuple conversion work which Vlad will do next week, as it might make the problem easier.
File is
InlineTemporaryTests.cs.There are some other refactorings which may be improved by this simplification. They print code like
default((string c, int d)). SeeTestTupleOptionalWithNamesinAddConstructorParametersTests.cs, andTupleWithNames_EqualsandTupleWithNames_HashCodeinGenerateEqualsAndGetHashCodeTests.cs