Skip to content

Commit 12e98f5

Browse files
committed
Review of newline usage, tweak phase strings
1 parent a52c9d6 commit 12e98f5

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

compiler/src/dotty/tools/dotc/config/CliCommand.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,13 @@ trait CliCommand:
143143
protected def value(using ss: SettingsState): T = setting.valueIn(ss)
144144

145145
extension (s: String)
146-
def padLeft(width: Int): String = StringBuilder().tap(_.append(" " * (width - s.length)).append(s)).toString
146+
def padLeft(width: Int): String = String.format(s"%${width}s", s)
147147

148148
// Formatting for -help and -Vphases in two columns, handling long field1 and wrapping long field2
149149
class Columnator(heading1: String, heading2: String, maxField: Int, separation: Int = 2):
150150
def apply(texts: List[List[(String, String)]])(using Context): String = StringBuilder().tap(columnate(_, texts)).toString
151151

152152
private def columnate(sb: StringBuilder, texts: List[List[(String, String)]])(using Context): Unit =
153-
import scala.util.Properties.{lineSeparator => EOL}
154153
import Highlighting.*
155154
val colors = Seq(Green(_), Yellow(_), Magenta(_), Cyan(_), Red(_))
156155
val nocolor = texts.length == 1
@@ -159,6 +158,7 @@ trait CliCommand:
159158
val field1 = maxField.min(texts.flatten.map(_._1.length).filter(_ < maxField).max) // widest field under maxField
160159
val field2 = if field1 + separation + maxField < maxCol then maxCol - field1 - separation else 0 // skinny window -> terminal wrap
161160
val separator = " " * separation
161+
val EOL = "\n"
162162
def formatField1(text: String): String = if text.length <= field1 then text.padLeft(field1) else text + EOL + "".padLeft(field1)
163163
def formatField2(text: String): String =
164164
def loopOverField2(fld: String): List[String] =

compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import dotty.tools.dotc.transform.MegaPhase.MiniPhase
1212

1313
object InterceptedMethods {
1414
val name: String = "intercepted"
15-
val description: String = "handling of `==`, `|=`, `getClass` methods"
15+
val description: String = "rewrite universal `!=`, `##` methods"
1616
}
1717

1818
/** Replace member references as follows:

compiler/src/dotty/tools/dotc/transform/LiftTry.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ class LiftTry extends MiniPhase with IdentityDenotTransformer { thisPhase =>
8585
}
8686
object LiftTry:
8787
val name = "liftTry"
88-
val description: String = "Lifts try's that might be executed on non-empty expression stacks"
88+
val description: String = "lift any try that might be executed on a non-empty expression stack"

compiler/src/dotty/tools/dotc/transform/UninitializedDefs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ class UninitializedDefs extends MiniPhase:
4343
end UninitializedDefs
4444

4545
object UninitializedDefs:
46-
val name: String = "uninitializedDefs"
47-
val description: String = "replaces `compiletime.uninitialized` by `_`"
46+
val name: String = "uninitialized"
47+
val description: String = "eliminates `compiletime.uninitialized`"
4848
end UninitializedDefs

compiler/src/dotty/tools/dotc/transform/localopt/StringInterpolatorOpt.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,5 @@ class StringInterpolatorOpt extends MiniPhase:
158158
case _ => tree
159159

160160
object StringInterpolatorOpt:
161-
val name: String = "stringInterpolatorOpt"
162-
val description: String = "optimize s, f and raw string interpolators"
161+
val name: String = "interpolators"
162+
val description: String = "optimize s, f, and raw string interpolators"

0 commit comments

Comments
 (0)