Skip to content

Commit 85f109f

Browse files
Merge pull request #5211 from dotty-staging/followup-5203
Followup to #5203
2 parents 3b7322f + 35646ae commit 85f109f

File tree

16 files changed

+28
-51
lines changed

16 files changed

+28
-51
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/tasty/TreePickler.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,7 @@ class TreePickler(pickler: TastyPickler) {
656656
// Such annotations will be reconstituted when unpickling the child class.
657657
// See tests/pickling/i3149.scala
658658
case _ =>
659-
if (Inliner.typedInline) ann.symbol == defn.BodyAnnot // inline bodies are reconstituted automatically when unpickling
660-
else false
659+
ann.symbol == defn.BodyAnnot // inline bodies are reconstituted automatically when unpickling
661660
}
662661

663662
def pickleAnnotation(owner: Symbol, ann: Annotation)(implicit ctx: Context): Unit =

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import core.quoted.PickledQuotes
2222
import scala.quoted
2323
import scala.quoted.Types.TreeType
2424
import scala.quoted.Exprs.TastyTreeExpr
25-
import typer.Inliner.typedInline
2625

2726
import scala.annotation.internal.sharable
2827

@@ -555,7 +554,7 @@ class TreeUnpickler(reader: TastyReader,
555554
sym.completer.withDecls(newScope)
556555
forkAt(templateStart).indexTemplateParams()(localContext(sym))
557556
}
558-
else if (typedInline && sym.isInlineMethod)
557+
else if (sym.isInlineMethod)
559558
sym.addAnnotation(LazyBodyAnnotation { ctx0 =>
560559
implicit val ctx: Context = localContext(sym)(ctx0).addMode(Mode.ReadPositions)
561560
// avoids space leaks by not capturing the current context
@@ -643,14 +642,9 @@ class TreeUnpickler(reader: TastyReader,
643642
val lazyAnnotTree = readLaterWithOwner(end, rdr => ctx => rdr.readTerm()(ctx))
644643

645644
owner =>
646-
if (tp.isRef(defn.BodyAnnot)) {
647-
assert(!typedInline)
648-
LazyBodyAnnotation(implicit ctx => lazyAnnotTree(owner).complete)
649-
}
650-
else
651-
Annotation.deferredSymAndTree(
652-
implicit ctx => tp.typeSymbol,
653-
implicit ctx => lazyAnnotTree(owner).complete)
645+
Annotation.deferredSymAndTree(
646+
implicit ctx => tp.typeSymbol,
647+
implicit ctx => lazyAnnotTree(owner).complete)
654648
}
655649

656650
/** Create symbols for the definitions in the statement sequence between
@@ -749,7 +743,7 @@ class TreeUnpickler(reader: TastyReader,
749743
def readRhs(implicit ctx: Context) =
750744
if (nothingButMods(end))
751745
EmptyTree
752-
else if (sym.isInlineMethod && typedInline)
746+
else if (sym.isInlineMethod)
753747
// The body of an inline method is stored in an annotation, so no need to unpickle it again
754748
new Trees.Lazy[Tree] {
755749
def complete(implicit ctx: Context) = typer.Inliner.bodyToInline(sym)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ 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)

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

0 commit comments

Comments
 (0)