Skip to content

Commit 6f50b0c

Browse files
committed
Followup to scala#5203
1 parent 786e6da commit 6f50b0c

File tree

11 files changed

+19
-20
lines changed

11 files changed

+19
-20
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ object Settings {
193193

194194
class SettingGroup {
195195

196-
private[this] val _allSettings: ArrayBuffer[Setting[_]] = new ArrayBuffer[Setting[_]]
196+
private[this] val _allSettings = new ArrayBuffer[Setting[_]]
197197
def allSettings: Seq[Setting[_]] = _allSettings
198198

199199
def defaultState: SettingsState = new SettingsState(allSettings map (_.default))

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,6 +1952,7 @@ object SymDenotations {
19521952
def apply(sym: Symbol): LazyType = this
19531953
def apply(module: TermSymbol, modcls: ClassSymbol): LazyType = this
19541954

1955+
private[this] val NoSymbolFn = (_: Context) => NoSymbol
19551956
private[this] var myDecls: Scope = EmptyScope
19561957
private[this] var mySourceModuleFn: Context => Symbol = NoSymbolFn
19571958
private[this] var myModuleClassFn: Context => Symbol = NoSymbolFn
@@ -1985,8 +1986,6 @@ object SymDenotations {
19851986
unsupported("completerTypeParams") // should be abstract, but Scala-2 will then compute the wrong type for it
19861987
}
19871988

1988-
val NoSymbolFn: Context => Symbol = (ctx: Context) => NoSymbol
1989-
19901989
/** A missing completer */
19911990
@sharable class NoCompleter extends LazyType {
19921991
def complete(denot: SymDenotation)(implicit ctx: Context): Unit = unsupported("complete")

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,11 @@ trait Symbols { this: Context =>
270270
newSymbol(cls, nme.CONSTRUCTOR, flags | Method, MethodType(paramNames, paramTypes, cls.typeRef), privateWithin, coord)
271271

272272
/** Create an empty default constructor symbol for given class `cls`. */
273-
def newDefaultConstructor(cls: ClassSymbol): Symbol =
273+
def newDefaultConstructor(cls: ClassSymbol): TermSymbol =
274274
newConstructor(cls, EmptyFlags, Nil, Nil)
275275

276276
/** Create a synthetic lazy implicit value */
277-
def newLazyImplicit(info: Type): Symbol =
277+
def newLazyImplicit(info: Type): TermSymbol =
278278
newSymbol(owner, LazyImplicitName.fresh(), Lazy, info)
279279

280280
/** Create a symbol representing a selftype declaration for class `cls`. */
@@ -308,7 +308,7 @@ trait Symbols { this: Context =>
308308
/** Create a new skolem symbol. This is not the same as SkolemType, even though the
309309
* motivation (create a singleton referencing to a type) is similar.
310310
*/
311-
def newSkolem(tp: Type): Symbol = newSymbol(defn.RootClass, nme.SKOLEM, SyntheticArtifact | NonMember | Permanent, tp)
311+
def newSkolem(tp: Type): TermSymbol = newSymbol(defn.RootClass, nme.SKOLEM, SyntheticArtifact | NonMember | Permanent, tp)
312312

313313
def newErrorSymbol(owner: Symbol, name: Name, msg: => Message): Symbol = {
314314
val errType = ErrorType(msg)

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,16 +758,16 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
758758
TempClassInfoType(until(end, () => readTypeRef()), symScope(clazz), clazz)
759759
case METHODtpe | IMPLICITMETHODtpe =>
760760
val restpe = readTypeRef()
761-
val params = until(end, () => readSymbolRef()).asInstanceOf[List[Symbol]]
761+
val params = until(end, () => readSymbolRef())
762762
def isImplicit =
763763
tag == IMPLICITMETHODtpe ||
764764
params.nonEmpty && (params.head is Implicit)
765765
val maker = MethodType.maker(isImplicit = isImplicit)
766766
maker.fromSymbols(params, restpe)
767767
case POLYtpe =>
768768
val restpe = readTypeRef()
769-
val typeParams = until(end, () => readSymbolRef())
770-
if (typeParams.nonEmpty) TempPolyType(typeParams.asInstanceOf[List[TypeSymbol]], restpe.widenExpr)
769+
val typeParams = until(end, () => readSymbolRef()).asInstanceOf[List[TypeSymbol]]
770+
if (typeParams.nonEmpty) TempPolyType(typeParams, restpe.widenExpr)
771771
else ExprType(restpe)
772772
case EXISTENTIALtpe =>
773773
val restpe = readTypeRef()

compiler/src/dotty/tools/dotc/parsing/Scanners.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ object Scanners {
8282

8383
/** A character buffer for literals
8484
*/
85-
protected val litBuf: mutable.StringBuilder = new StringBuilder
85+
protected val litBuf = new mutable.StringBuilder
8686

8787
/** append Unicode character to "litBuf" buffer
8888
*/
@@ -194,7 +194,7 @@ object Scanners {
194194
def getDocComment(pos: Int): Option[Comment] = docstringMap.get(pos)
195195

196196
/** A buffer for comments */
197-
private[this] val commentBuf: mutable.StringBuilder = new StringBuilder
197+
private[this] val commentBuf = new mutable.StringBuilder
198198

199199
private def handleMigration(keyword: Token): Token =
200200
if (!isScala2Mode) keyword

compiler/src/dotty/tools/dotc/printing/Highlighting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object Highlighting {
3131
}
3232

3333
case class HighlightBuffer(hl: Highlight)(implicit ctx: Context) {
34-
private[this] val buffer: mutable.ListBuffer[String] = new mutable.ListBuffer[String]
34+
private[this] val buffer = new mutable.ListBuffer[String]
3535

3636
buffer += hl.show
3737

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Erasure extends Phase with DenotTransformer {
9090
ref.derivedSingleDenotation(ref.symbol, transformInfo(ref.symbol, ref.symbol.info))
9191
}
9292

93-
private val eraser: Erasure.Typer = new Erasure.Typer(this)
93+
private[this] val eraser = new Erasure.Typer(this)
9494

9595
def run(implicit ctx: Context): Unit = {
9696
val unit = ctx.compilationUnit

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class FunctionalInterfaces extends MiniPhase {
2323

2424
def phaseName: String = FunctionalInterfaces.name
2525

26-
private val functionName: TermName = "JFunction".toTermName
27-
private val functionPackage: TermName = "scala.compat.java8.".toTermName
26+
private[this] val functionName = "JFunction".toTermName
27+
private[this] val functionPackage = "scala.compat.java8.".toTermName
2828

2929
override def transformClosure(tree: Closure)(implicit ctx: Context): Tree = {
3030
val cls = tree.tpe.widen.classSymbol.asClass

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer {
2929
/** this map contains mutable state of transformation: OffsetDefs to be appended to companion object definitions,
3030
* and number of bits currently used */
3131
class OffsetInfo(var defs: List[Tree], var ord:Int)
32-
private[this] val appendOffsetDefs: mutable.Map[Symbol, OffsetInfo] = mutable.Map.empty[Symbol, OffsetInfo]
32+
private[this] val appendOffsetDefs = mutable.Map.empty[Symbol, OffsetInfo]
3333

3434
override def phaseName: String = "lazyVals"
3535

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class TreeChecker extends Phase with SymTransformer {
130130

131131
class Checker(phasesToCheck: Seq[Phase]) extends ReTyper with Checking {
132132

133-
private[this] val nowDefinedSyms: mutable.HashSet[Symbol] = new mutable.HashSet[Symbol]
134-
private[this] val everDefinedSyms: MutableSymbolMap[untpd.Tree] = newMutableSymbolMap[untpd.Tree]
133+
private[this] val nowDefinedSyms = new mutable.HashSet[Symbol]
134+
private[this] val everDefinedSyms = newMutableSymbolMap[untpd.Tree]
135135

136136
// don't check value classes after typer, as the constraint about constructors doesn't hold after transform
137137
override def checkDerivedValueClass(clazz: Symbol, stats: List[Tree])(implicit ctx: Context): Unit = ()

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ trait NamerContextOps { this: Context =>
137137
if (isJava)
138138
for (param <- params)
139139
if (param.info.isDirectRef(defn.ObjectClass)) param.info = defn.AnyType
140-
make.fromSymbols(params.asInstanceOf[List[Symbol]], resultType)
140+
make.fromSymbols(params, resultType)
141141
}
142142
if (typeParams.nonEmpty) PolyType.fromParams(typeParams.asInstanceOf[List[TypeSymbol]], monotpe)
143143
else if (valueParamss.isEmpty) ExprType(monotpe)
@@ -840,7 +840,7 @@ class Namer { typer: Typer =>
840840

841841
val TypeDef(name, impl @ Template(constr, parents, self, _)) = original
842842

843-
private val ((params: List[Tree]), (rest: List[Tree])) = impl.body span {
843+
private val (params, rest): (List[Tree], List[Tree]) = impl.body.span {
844844
case td: TypeDef => td.mods is Param
845845
case vd: ValDef => vd.mods is ParamAccessor
846846
case _ => false

0 commit comments

Comments
 (0)