Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Oct 19, 2021
1 parent a55501f commit 004bf65
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Compilers/CSharp/Portable/Syntax/SyntaxNormalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ private static bool NeedsSeparatorForPositionalPattern(SyntaxToken token, Syntax

private static bool NeedsSeparatorForListPattern(SyntaxToken token, SyntaxToken next)
{
ListPatternSyntax? listPattern;
ListPatternSyntax listPattern;
if (token.Parent.IsKind(SyntaxKind.ListPattern))
{
listPattern = (ListPatternSyntax)token.Parent;
Expand All @@ -537,15 +537,13 @@ private static bool NeedsSeparatorForListPattern(SyntaxToken token, SyntaxToken
}

// is$$[1, 2]
var nextIsOpenBracket = next.IsKind(SyntaxKind.OpenBracketToken);
if (nextIsOpenBracket)
if (next.IsKind(SyntaxKind.OpenBracketToken))
{
return true;
}

// is [1, 2]$$list
var tokenIsOpenBracket = token.IsKind(SyntaxKind.OpenBracketToken);
if (tokenIsOpenBracket)
if (token.IsKind(SyntaxKind.OpenBracketToken))
{
return listPattern.Designation is not null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,33 @@ public void Array_Nested()
CheckStart(session.Session);
}

[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ListPattern()
{
var code = @"
class C
{
void M(object o)
{
_ = o is $$
}
}
";
var expected = @"
class C
{
void M(object o)
{
_ = o is [
]

This comment has been minimized.

Copy link
@CyrusNajmabadi

CyrusNajmabadi Oct 19, 2021

Member

this seems... not good :)

}
}
";
using var session = CreateSession(code);
CheckStart(session.Session);
CheckReturn(session.Session, 0, expected);
}

internal static Holder CreateSession(string code)
{
return CreateSession(
Expand Down

0 comments on commit 004bf65

Please sign in to comment.