File tree Expand file tree Collapse file tree
StyleCop.Analyzers.Test/LayoutRules
StyleCop.Analyzers/LayoutRules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -358,6 +358,23 @@ public void MultiLineLinqQuery()
358358 }).ToList();
359359 }
360360
361+ // This is a regression test for https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2306
362+ public void MultiLineGroupByLinqQuery()
363+ {
364+ var someQuery = from f in Enumerable.Empty<int>()
365+ group f by new
366+ {
367+ f,
368+ }
369+ into a
370+ select a;
371+
372+ var someOtherQuery = from f in Enumerable.Empty<int>()
373+ group f by new { f }
374+ into a
375+ select a;
376+ }
377+
361378 // This is a regression test for https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1049
362379 public object[] ExpressionBodiedProperty =>
363380 new[]
Original file line number Diff line number Diff line change @@ -230,10 +230,15 @@ private void AnalyzeCloseBrace(SyntaxToken token)
230230 return ;
231231 }
232232
233- if ( IsPartOf < QueryExpressionSyntax > ( token ) & & ( ( nextToken . Parent is QueryClauseSyntax ) || ( nextToken . Parent is SelectOrGroupClauseSyntax ) ) )
233+ if ( IsPartOf < QueryExpressionSyntax > ( token ) )
234234 {
235- // the close brace is part of a query expression
236- return ;
235+ if ( nextToken . Parent is QueryClauseSyntax
236+ || nextToken . Parent is SelectOrGroupClauseSyntax
237+ || nextToken . Parent is QueryContinuationSyntax )
238+ {
239+ // the close brace is part of a query expression
240+ return ;
241+ }
237242 }
238243
239244 if ( IsPartOf < ArgumentListSyntax > ( token ) )
You can’t perform that action at this time.
0 commit comments