diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/DeconstructionTest.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/DeconstructionTest.cs index 33e759295b5e6..c75aefbc9b641 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/DeconstructionTest.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/DeconstructionTest.cs @@ -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 @@ -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()); + } } }