Skip to content

Commit

Permalink
FormatTokens: fix getLastExceptParen, incl comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 20, 2024
1 parent 86262d6 commit c684eb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ class FormatTokens(leftTok2tok: Map[TokenHash, Int])(val arr: Array[FT])

def getLastExceptParen(tree: Tree): FT = {
val tokens = tree.tokens
val last = getLastNonTrivial(tokens, tree)
getClosingIfWithinParens(last)(getHead(tokens, tree)).getOrElse(last)
val last = getLast(tokens, tree)
getClosingIfWithinParens(prevNonComment(last))(getHead(tokens, tree))
.getOrElse(last)
}

final def findTokenWith[A](ft: FT, iter: FT => FT)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CommunitySpark3_4Suite extends CommunitySparkSuite("spark-3.4") {

class CommunitySpark3_5Suite extends CommunitySparkSuite("spark-3.5") {

override protected def totalStatesVisited: Option[Int] = Some(91352350)
override protected def totalStatesVisited: Option[Int] = Some(91352348)

override protected def builds =
Seq(getBuild("v3.5.3", dialects.Scala213, 2756))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7925,11 +7925,12 @@ object a:
case d if e => f
// comment
>>>
Idempotency violated
=> Diff (- obtained, + expected)
f
- // comment
+ // comment
object a:
b.c
.match
case d if e =>
f
// comment
<<< match without dot, trailing case comment
object a:
b.c match
Expand Down

0 comments on commit c684eb2

Please sign in to comment.