Skip to content

Commit

Permalink
FormatWriter: mind rewritten tokens for {} -> ()
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 8, 2024
1 parent 27f216e commit fe1b10d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class FormatWriter(formatOps: FormatOps) {
val ok = tok.meta.leftOwner match {
case b: Term.Block =>
checkApply(b) && RedundantBraces.canRewriteBlockWithParens(b) &&
b.parent.exists(_.tokens.last.start == rb.start)
b.parent.exists(tokens.getLast(_) eq tok)
case f: Term.FunctionTerm =>
checkApply(f) && RedundantBraces.canRewriteFuncWithParens(f)
case t @ TreeOps.SingleArgInBraces(arg) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,4 @@ rewrite.rules = [RedundantBraces, RedundantParens]
===
foo.mtd({ x => x + 1 })
>>>
Idempotency violated
=> Diff (- obtained, + expected)
-foo.mtd(x => x + 1)
+foo.mtd { x => x + 1 }
foo.mtd(x => x + 1)

0 comments on commit fe1b10d

Please sign in to comment.