Skip to content

Commit c61aefd

Browse files
committed
Review of newline usage, tweak phase strings
1 parent 402567b commit c61aefd

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
@@ -146,14 +146,13 @@ trait CliCommand:
146146
protected def value(using ss: SettingsState): T = setting.valueIn(ss)
147147

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

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

155155
private def columnate(sb: StringBuilder, texts: List[List[(String, String)]])(using Context): Unit =
156-
import scala.util.Properties.{lineSeparator => EOL}
157156
import Highlighting.*
158157
val colors = Seq(Green(_), Yellow(_), Magenta(_), Cyan(_), Red(_))
159158
val nocolor = texts.length == 1
@@ -162,6 +161,7 @@ trait CliCommand:
162161
val field1 = maxField.min(texts.flatten.map(_._1.length).filter(_ < maxField).max) // widest field under maxField
163162
val field2 = if field1 + separation + maxField < maxCol then maxCol - field1 - separation else 0 // skinny window -> terminal wrap
164163
val separator = " " * separation
164+
val EOL = "\n"
165165
def formatField1(text: String): String = if text.length <= field1 then text.padLeft(field1) else text + EOL + "".padLeft(field1)
166166
def formatField2(text: String): String =
167167
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
@@ -13,7 +13,7 @@ import dotty.tools.dotc.transform.MegaPhase.MiniPhase
1313

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

1919
/** 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
@@ -47,6 +47,6 @@ class UninitializedDefs extends MiniPhase:
4747
end UninitializedDefs
4848

4949
object UninitializedDefs:
50-
val name: String = "uninitializedDefs"
51-
val description: String = "replaces `compiletime.uninitialized` by `_`"
50+
val name: String = "uninitialized"
51+
val description: String = "eliminates `compiletime.uninitialized`"
5252
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
@@ -182,5 +182,5 @@ class StringInterpolatorOpt extends MiniPhase {
182182
}
183183

184184
object StringInterpolatorOpt:
185-
val name: String = "stringInterpolatorOpt"
186-
val description: String = "optimize raw and s string interpolators"
185+
val name: String = "interpolators"
186+
val description: String = "optimize raw, s, and f string interpolators"

0 commit comments

Comments
 (0)