From a83bb16d04501e4bb9c6b730e933ac9ce217b395 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Mon, 23 Jan 2023 11:21:08 -0800 Subject: [PATCH] FormatOps: handle fewer braces and refined types --- .../org/scalafmt/internal/FormatOps.scala | 28 +++++++ .../scala/org/scalafmt/internal/Indent.scala | 1 + .../scala/org/scalafmt/internal/Router.scala | 64 ++++++++++----- .../org/scalafmt/util/TreeExtractors.scala | 4 + .../scala/org/scalafmt/util/TreeOps.scala | 3 + .../test/resources/scala3/OptionalBraces.stat | 70 ++++++++-------- .../resources/scala3/OptionalBraces_fold.stat | 80 +++++++++---------- .../resources/scala3/OptionalBraces_keep.stat | 74 ++++++++--------- .../scala3/OptionalBraces_unfold.stat | 80 ++++++++++--------- 9 files changed, 230 insertions(+), 174 deletions(-) diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala index fd8c4de6e1..a1870f0992 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala @@ -2037,6 +2037,34 @@ class FormatOps( def splits = Some(getSplits(ft, t, forceNL = true)) def rightBrace = if (isSeqMulti(t.stats)) treeLast(t) else None }) + case t: Type.Refine => + Some(new OptionalBracesRegion { + def owner = Some(t) + def splits = Some(getSplits(ft, t, forceNL = true)) + def rightBrace = treeLast(t) + }) + case t: Term.ArgClause if tokens.getHead(t) eq ft => + def funcSplit(arg: Term.FunctionTerm)(implicit fl: FileLine) = { + val end = tokens.getLast(arg) + val opt = getOptimalTokenFor(getFuncArrow(arg).getOrElse(end)) + Split(Space, 0) + .withSingleLine(opt) + .andPolicy(decideNewlinesOnlyAfterToken(opt)) + } + Some(new OptionalBracesRegion { + def owner = t.parent + def splits = Some(t.values match { + case (tf: Term.FunctionTerm) :: Nil + if !style.newlines.alwaysBeforeCurlyLambdaParams && + t.parent.exists(_.is[Term.Apply]) => + getSplits(ft, t, forceNL = false) match { + case s +: rs if !s.isNL => funcSplit(tf)(s.fileLine) +: rs + case ss => ss + } + case _ => getSplits(ft, t, forceNL = true) + }) + def rightBrace = treeLast(t) + }) case _ => None } } diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Indent.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Indent.scala index c1f8b9e56a..93bbeddd29 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Indent.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Indent.scala @@ -108,6 +108,7 @@ object Indent { case x => new IndentImpl(x, expire, expiresAt) } + @inline def empty: Indent = Empty case object Empty extends Indent { override def withStateOffset(offset: Int): Option[ActualIndent] = None override def switch(trigger: Token, on: Boolean): Indent = this diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala index cf869218af..74d5f975d4 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala @@ -457,7 +457,12 @@ class Router(formatOps: FormatOps) { val indent = // don't indent if the body is empty `{ x => }` if (isEmptyFunctionBody(leftOwner) && !right.is[T.Comment]) 0 else if (leftOwner.is[Template]) 0 // { applied the indent - else style.indent.main + else + leftOwner.parent match { + case Some(ArgClauseParent(p: Term.Apply)) if isFewerBraces(p) => + style.indent.getSignificant + case _ => style.indent.main + } def noSingleLine = { // for constructors with empty args lambda @@ -1718,6 +1723,23 @@ class Router(formatOps: FormatOps) { val expire = getLastEnclosedToken(expireTree) val indentLen = style.indent.main + val nextDotIfSig = nextSelect.flatMap { ns => + val ok = ns.qual match { + case p: Term.Apply => isFewerBraces(p) + case p: Term.Match => !tokenBefore(p.cases).left.is[T.LeftBrace] + case _ => false + } + if (ok) Some(tokenBefore(ns.nameToken)) else None + } + def forcedBreakOnNextDotPolicy = nextSelect.map { selectLike => + val tree = selectLike.tree + Policy.before(selectLike.nameToken) { + case d @ Decision(FormatToken(_, _: T.Dot, m), _) + if m.rightOwner eq tree => + d.onlyNewlinesWithoutFallback + } + } + def breakOnNextDot: Policy = nextSelect.fold(Policy.noPolicy) { selectLike => val tree = selectLike.tree @@ -1828,29 +1850,29 @@ class Router(formatOps: FormatOps) { if (prevSelect.isEmpty && nextSelect.isEmpty) Seq(Split(NoSplit, 0), Split(Newline, 1)) else { - val forcedBreakPolicy = nextSelect.map { selectLike => - val tree = selectLike.tree - Policy.before(selectLike.nameToken) { - case d @ Decision(FormatToken(_, _: T.Dot, m), _) - if m.rightOwner eq tree => - d.onlyNewlinesWithoutFallback - } - } Seq( Split(NoSplit, 0).withSingleLine(expire, noSyntaxNL = true), Split(NewlineT(alt = Some(NoSplit)), 1) - .withPolicyOpt(forcedBreakPolicy) + .withPolicyOpt(forcedBreakOnNextDotPolicy) ) } case Newlines.fold => - val end = - nextSelect.fold(expire)(x => getLastNonTrivialToken(x.qual)) - def exclude = insideBracesBlock(t, end, true) - Seq( - Split(NoSplit, 0).withSingleLine(end, exclude), - Split(NewlineT(alt = Some(NoSplit)), 1) - ) + if (nextDotIfSig.isEmpty) { + val end = + nextSelect.fold(expire)(x => getLastNonTrivialToken(x.qual)) + def exclude = insideBracesBlock(t, end, true) + Seq( + Split(NoSplit, 0).withSingleLine(end, exclude), + Split(NewlineT(alt = Some(NoSplit)), 1) + ) + } else { + val policy = forcedBreakOnNextDotPolicy + Seq( + Split(NoSplit, 0).andPolicyOpt(policy), + Split(NewlineT(alt = Some(NoSplit)), 1).withPolicyOpt(policy) + ) + } } val delayedBreakPolicyOpt = nextSelect.map { selectLike => @@ -1866,11 +1888,13 @@ class Router(formatOps: FormatOps) { } // trigger indent only on the first newline - val indent = Indent(indentLen, expire, After) + val nlIndent = Indent(indentLen, expire, After) + val spcIndent = nextDotIfSig + .fold(Indent.empty)(x => Indent(indentLen, x.left, ExpiresOn.Before)) val willBreak = nextNonCommentSameLine(tokens(t, 2)).right.is[T.Comment] val splits = baseSplits.map { s => - if (willBreak || s.isNL) s.withIndent(indent) - else s.andFirstPolicyOpt(delayedBreakPolicyOpt) + if (willBreak || s.isNL) s.withIndent(nlIndent) + else s.andFirstPolicyOpt(delayedBreakPolicyOpt).withIndent(spcIndent) } if (prevSelect.isEmpty) splits diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeExtractors.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeExtractors.scala index 44c9ca3b6e..1cf191db9e 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeExtractors.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeExtractors.scala @@ -86,3 +86,7 @@ object ParamClauseParent { case p => p } } + +object ArgClauseParent { + def unapply(t: Member.ArgClause): Option[Tree] = t.parent +} diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeOps.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeOps.scala index 022c88ba50..fce249909b 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeOps.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/util/TreeOps.scala @@ -1004,4 +1004,7 @@ object TreeOps { case _ => None }) + def isFewerBraces(tree: Term.Apply)(implicit dialect: Dialect): Boolean = + dialect.allowFewerBraces && tree.argClause.tokens.head.is[Colon] + } diff --git a/scalafmt-tests/src/test/resources/scala3/OptionalBraces.stat b/scalafmt-tests/src/test/resources/scala3/OptionalBraces.stat index ed585c0ad0..517c8c5502 100644 --- a/scalafmt-tests/src/test/resources/scala3/OptionalBraces.stat +++ b/scalafmt-tests/src/test/resources/scala3/OptionalBraces.stat @@ -3606,12 +3606,10 @@ object a: List(1, 2, 3).foldLeft(1): case (a, b) => a + b >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foldLeft(1): - case (a, b) => a + b - ^ + case (a, b) => a + b <<< coloneol in fewer braces 1, main > sig maxColumn = 80 indent.main = 4 @@ -3621,12 +3619,10 @@ object a: List(1, 2, 3).foldLeft(1): case (a, b) => a + b >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foldLeft(1): - case (a, b) => a + b - ^ + case (a, b) => a + b <<< coloneol in fewer braces 2 maxColumn = 80 === @@ -3639,12 +3635,15 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3) - .foo: a => a + 2 - ^ + .foo: a => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 2, main > sig maxColumn = 80 indent.main = 4 @@ -3658,12 +3657,15 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3) - .foo: a => a + 2 - ^ + .foo: a => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 3 maxColumn = 80 === @@ -3674,12 +3676,12 @@ object a: case _ => otherTerm() >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foo: - case a: Int => - ^ + case a: Int => + case _ => + otherTerm() <<< coloneol in fewer braces 3, main > sig maxColumn = 80 indent.main = 4 @@ -3691,12 +3693,12 @@ object a: case _ => otherTerm() >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foo: - case a: Int => - ^ + case a: Int => + case _ => + otherTerm() <<< match with eol maxColumn = 80 === @@ -3709,13 +3711,14 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).match - case _ => a + 2 - .foo: a => 2 + a - ^ + case _ => a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< match with eol, main > sig maxColumn = 80 indent.main = 4 @@ -3729,13 +3732,14 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).match - case _ => a + 2 - .foo: a => 2 + a - ^ + case _ => a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in refined types maxColumn = 80 === @@ -3743,10 +3747,9 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = String: - ^ + type U = Int <<< coloneol in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3755,10 +3758,9 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = String: - ^ + type U = Int <<< with in refined types maxColumn = 80 === @@ -3766,11 +3768,9 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = String with - type U = Int - ^ + type U = Int <<< with in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3779,8 +3779,6 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = String with - type U = Int - ^ + type U = Int diff --git a/scalafmt-tests/src/test/resources/scala3/OptionalBraces_fold.stat b/scalafmt-tests/src/test/resources/scala3/OptionalBraces_fold.stat index 40c5399834..9c7a9fdf5b 100644 --- a/scalafmt-tests/src/test/resources/scala3/OptionalBraces_fold.stat +++ b/scalafmt-tests/src/test/resources/scala3/OptionalBraces_fold.stat @@ -3432,9 +3432,8 @@ object a: case (a, b) => a + b >>> object a: - def f(): Unit = List(1, 2, 3) - .foldLeft(1): - case (a, b) => a + b + def f(): Unit = List(1, 2, 3).foldLeft(1): + case (a, b) => a + b <<< coloneol in fewer braces 1, main > sig maxColumn = 80 indent.main = 4 @@ -3445,9 +3444,8 @@ object a: case (a, b) => a + b >>> object a: - def f(): Unit = List(1, 2, 3) - .foldLeft(1): - case (a, b) => a + b + def f(): Unit = List(1, 2, 3).foldLeft(1): + case (a, b) => a + b <<< coloneol in fewer braces 2 maxColumn = 80 === @@ -3460,10 +3458,13 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: - def f(): Unit = List(1, 2, 3).foo: a => a + 2.foo: a => 2 + a.apply: 12 + 3 - ^ + def f(): Unit = List(1, 2, 3).foo: a => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 2, main > sig maxColumn = 80 indent.main = 4 @@ -3477,10 +3478,13 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: - def f(): Unit = List(1, 2, 3).foo: a => a + 2.foo: a => 2 + a.apply: 12 + 3 - ^ + def f(): Unit = List(1, 2, 3).foo: a => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 3 maxColumn = 80 === @@ -3491,12 +3495,12 @@ object a: case _ => otherTerm() >>> -Idempotency violated object a: - def f(): Unit = List(1, 2, 3) - .foo: - case a: Int => - case _ => otherTerm() + def f(): Unit = + List(1, 2, 3).foo: + case a: Int => + case _ => + otherTerm() <<< coloneol in fewer braces 3, main > sig maxColumn = 80 indent.main = 4 @@ -3508,12 +3512,12 @@ object a: case _ => otherTerm() >>> -Idempotency violated object a: - def f(): Unit = List(1, 2, 3) - .foo: - case a: Int => - case _ => otherTerm() + def f(): Unit = + List(1, 2, 3).foo: + case a: Int => + case _ => + otherTerm() <<< match with eol maxColumn = 80 === @@ -3526,12 +3530,13 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).match - case _ => a + 2 - .foo: a => 2 + a.apply: 12 + 3 - ^ + case _ => a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< match with eol, main > sig maxColumn = 80 indent.main = 4 @@ -3545,12 +3550,13 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).match - case _ => a + 2 - .foo: a => 2 + a.apply: 12 + 3 - ^ + case _ => a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in refined types maxColumn = 80 === @@ -3558,10 +3564,9 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = String: - ^ + type U = Int <<< coloneol in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3570,10 +3575,9 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = String: - ^ + type U = Int <<< with in refined types maxColumn = 80 === @@ -3581,11 +3585,9 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = String with - type U = Int - ^ + type U = Int <<< with in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3594,8 +3596,6 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = String with - type U = Int - ^ + type U = Int diff --git a/scalafmt-tests/src/test/resources/scala3/OptionalBraces_keep.stat b/scalafmt-tests/src/test/resources/scala3/OptionalBraces_keep.stat index d51cd3d3b0..b1427f3706 100644 --- a/scalafmt-tests/src/test/resources/scala3/OptionalBraces_keep.stat +++ b/scalafmt-tests/src/test/resources/scala3/OptionalBraces_keep.stat @@ -3588,12 +3588,10 @@ object a: List(1, 2, 3).foldLeft(1): case (a, b) => a + b >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foldLeft(1): - case (a, b) => a + b - ^ + case (a, b) => a + b <<< coloneol in fewer braces 1, main > sig maxColumn = 80 indent.main = 4 @@ -3603,12 +3601,10 @@ object a: List(1, 2, 3).foldLeft(1): case (a, b) => a + b >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foldLeft(1): - case (a, b) => a + b - ^ + case (a, b) => a + b <<< coloneol in fewer braces 2 maxColumn = 80 === @@ -3621,14 +3617,14 @@ object a: .apply: 12 + 3 >>> -Idempotency violated object a: def f(): Unit = List(1, 2, 3).foo: a => - a + 2 - .foo: a => - 2 + a - .apply: 12 + 3 + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 2, main > sig maxColumn = 80 indent.main = 4 @@ -3642,14 +3638,14 @@ object a: .apply: 12 + 3 >>> -Idempotency violated object a: def f(): Unit = List(1, 2, 3).foo: a => - a + 2 - .foo: a => - 2 + a - .apply: 12 + 3 + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 3 maxColumn = 80 === @@ -3660,12 +3656,12 @@ object a: case _ => otherTerm() >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foo: - case a: Int => - ^ + case a: Int => + case _ => + otherTerm() <<< coloneol in fewer braces 3, main > sig maxColumn = 80 indent.main = 4 @@ -3677,12 +3673,12 @@ object a: case _ => otherTerm() >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foo: - case a: Int => - ^ + case a: Int => + case _ => + otherTerm() <<< match with eol maxColumn = 80 === @@ -3695,14 +3691,14 @@ object a: .apply: 12 + 3 >>> -Idempotency violated object a: def f(): Unit = List(1, 2, 3).match - case _ => a + 2 - .foo: a => - 2 + a - .apply: 12 + 3 + case _ => a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< match with eol, main > sig maxColumn = 80 indent.main = 4 @@ -3716,14 +3712,14 @@ object a: .apply: 12 + 3 >>> -Idempotency violated object a: def f(): Unit = List(1, 2, 3).match - case _ => a + 2 - .foo: a => - 2 + a - .apply: 12 + 3 + case _ => a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in refined types maxColumn = 80 === @@ -3731,10 +3727,9 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = String: - ^ + type U = Int <<< coloneol in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3743,10 +3738,9 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = String: - ^ + type U = Int <<< with in refined types maxColumn = 80 === @@ -3754,11 +3748,9 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = String with - type U = Int - ^ + type U = Int <<< with in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3767,8 +3759,6 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = String with - type U = Int - ^ + type U = Int diff --git a/scalafmt-tests/src/test/resources/scala3/OptionalBraces_unfold.stat b/scalafmt-tests/src/test/resources/scala3/OptionalBraces_unfold.stat index 8eb5f06791..f4d329769d 100644 --- a/scalafmt-tests/src/test/resources/scala3/OptionalBraces_unfold.stat +++ b/scalafmt-tests/src/test/resources/scala3/OptionalBraces_unfold.stat @@ -3729,12 +3729,11 @@ object a: List(1, 2, 3).foldLeft(1): case (a, b) => a + b >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foldLeft(1): - case (a, b) => - ^ + case (a, b) => + a + b <<< coloneol in fewer braces 1, main > sig maxColumn = 80 indent.main = 4 @@ -3744,12 +3743,11 @@ object a: List(1, 2, 3).foldLeft(1): case (a, b) => a + b >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foldLeft(1): - case (a, b) => - ^ + case (a, b) => + a + b <<< coloneol in fewer braces 2 maxColumn = 80 === @@ -3762,10 +3760,14 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: - def f(): Unit = List(1, 2, 3).foo: a => a + 2.foo: a => 2 + a.apply: 12 + 3 - ^ + def f(): Unit = List(1, 2, 3) + .foo: a => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 2, main > sig maxColumn = 80 indent.main = 4 @@ -3779,10 +3781,14 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: - def f(): Unit = List(1, 2, 3).foo: a => a + 2.foo: a => 2 + a.apply: 12 + 3 - ^ + def f(): Unit = List(1, 2, 3) + .foo: a => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in fewer braces 3 maxColumn = 80 === @@ -3793,12 +3799,12 @@ object a: case _ => otherTerm() >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foo: - case a: Int => - ^ + case a: Int => + case _ => + otherTerm() <<< coloneol in fewer braces 3, main > sig maxColumn = 80 indent.main = 4 @@ -3810,12 +3816,12 @@ object a: case _ => otherTerm() >>> -test does not parse object a: def f(): Unit = List(1, 2, 3).foo: - case a: Int => - ^ + case a: Int => + case _ => + otherTerm() <<< match with eol maxColumn = 80 === @@ -3828,12 +3834,16 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3) - .foo: a => 2 + a - ^ + .match + case _ => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< match with eol, main > sig maxColumn = 80 indent.main = 4 @@ -3847,12 +3857,16 @@ object a: .apply: 12 + 3 >>> -test does not parse object a: def f(): Unit = List(1, 2, 3) - .foo: a => 2 + a - ^ + .match + case _ => + a + 2 + .foo: a => + 2 + a + .apply: + 12 + 3 <<< coloneol in refined types maxColumn = 80 === @@ -3860,11 +3874,10 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = - String: - ^ + String: + type U = Int <<< coloneol in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3873,11 +3886,10 @@ object a: type T = String: type U = Int >>> -test does not parse object a: type T = String: - ^ + type U = Int <<< with in refined types maxColumn = 80 === @@ -3885,12 +3897,10 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = - String with - type U = Int - ^ + String with + type U = Int <<< with in refined types, main > sig maxColumn = 80 indent.main = 4 @@ -3899,9 +3909,7 @@ object a: type T = String with type U = Int >>> -test does not parse object a: type T = String with - type U = Int - ^ + type U = Int