Skip to content

Commit

Permalink
Deconstruction-assignment: PR feedback (3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed May 19, 2016
1 parent 64ebafb commit b3cf56f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Compilers/CSharp/Test/Syntax/Parsing/DeconstructionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Parsing
// `(E, ...) = ...;` is a deconstruction-assignment, which starts with a tuple literal/expression
// `(E, ...).Foo();` starts with a tuple literal/expression
// `(E, ...) + ...` also starts with a tuple literal/expression
// `(T, ...)? id;` starts with a tuple type

[CompilerTrait(CompilerFeature.Tuples)]
public class DeconstructionTests : ParsingTests
Expand Down Expand Up @@ -771,5 +772,15 @@ public void InvalidStatement()
Assert.True(statement.HasErrors);
}

[Fact]
public void NullableTuple()
{
var text = "(x, y)? z = M();";
var statement = SyntaxFactory.ParseStatement(text, offset: 0, options: TestOptions.Regular.WithTuplesFeature());
Assert.False(statement.HasErrors);
var declaration = ((LocalDeclarationStatementSyntax)statement).Declaration;
var nullable = (NullableTypeSyntax)declaration.Type;
Assert.Equal(SyntaxKind.TupleType, nullable.ElementType.Kind());
}
}
}

0 comments on commit b3cf56f

Please sign in to comment.