Skip to content

Commit 55c2a1c

Browse files
Address review
1 parent 931b181 commit 55c2a1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+330
-329
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
7676
type LabelDef = tpd.DefDef
7777
type Closure = tpd.Closure
7878

79-
val NoSymbol: Symbols.NoSymbol.type = Symbols.NoSymbol
79+
val NoSymbol: Symbol = Symbols.NoSymbol
8080
val NoPosition: Position = Positions.NoPosition
8181
val EmptyTree: Tree = tpd.EmptyTree
8282

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import dotty.tools.io._
3232
class GenBCode extends Phase {
3333
def phaseName: String = GenBCode.name
3434
private val entryPoints = new mutable.HashSet[Symbol]()
35-
def registerEntryPoint(sym: Symbol): mutable.HashSet[Symbol] = entryPoints += sym
35+
def registerEntryPoint(sym: Symbol): Unit = entryPoints += sym
3636

3737
private val superCallsMap = newMutableSymbolMap[Set[ClassSymbol]]
3838
def registerSuperCall(sym: Symbol, calls: ClassSymbol): Unit = {
@@ -70,9 +70,9 @@ object GenBCode {
7070

7171
class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInterface)(implicit val ctx: Context) extends BCodeSyncAndTry {
7272

73-
var tree: Tree = _
73+
private[this] var tree: Tree = _
7474

75-
val sourceFile: SourceFile = ctx.compilationUnit.source
75+
private[this] val sourceFile: SourceFile = ctx.compilationUnit.source
7676

7777
/** Convert a `dotty.tools.io.AbstractFile` into a
7878
* `dotty.tools.dotc.interfaces.AbstractFile`.

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ object desugar {
609609
else cpy.ValDef(self)(tpt = selfType).withMods(self.mods | SelfName)
610610
}
611611

612-
val cdef1: DefTree = addEnumFlags {
612+
val cdef1 = addEnumFlags {
613613
val originalTparamsIt = impliedTparams.toIterator
614614
val originalVparamsIt = originalVparamss.toIterator.flatten
615615
val tparamAccessors = derivedTparams.map(_.withMods(originalTparamsIt.next().mods))

compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ object DesugarEnums {
2020
}
2121

2222
/** Attachment containing the number of enum cases and the smallest kind that was seen so far. */
23-
val EnumCaseCount: Property.Key[(Int, DesugarEnums.CaseKind.Value)] = new Property.Key[(Int, CaseKind.Value)]
23+
val EnumCaseCount: Property.Key[(Int, DesugarEnums.CaseKind.Value)] = new Property.Key
2424

2525
/** The enumeration class that belongs to an enum case. This works no matter
2626
* whether the case is still in the enum class or it has been transferred to the
@@ -68,7 +68,7 @@ object DesugarEnums {
6868
if (enumClass.exists) TypeTree(enumClass.typeRef) else TypeTree()
6969

7070
/** Add implied flags to an enum class or an enum case */
71-
def addEnumFlags(cdef: TypeDef)(implicit ctx: Context): cdef.ThisTree[Untyped] =
71+
def addEnumFlags(cdef: TypeDef)(implicit ctx: Context): TypeDef =
7272
if (cdef.mods.isEnumClass) cdef.withMods(cdef.mods.withFlags(cdef.mods.flags | Abstract | Sealed))
7373
else if (isEnumCase(cdef)) cdef.withMods(cdef.mods.withFlags(cdef.mods.flags | Final))
7474
else cdef

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object Trees {
2828
@sharable var ntrees: Int = 0
2929

3030
/** Property key for trees with documentation strings attached */
31-
val DocComment: Property.StickyKey[Comments.Comment] = new Property.StickyKey[Comment]
31+
val DocComment: Property.StickyKey[Comments.Comment] = new Property.StickyKey
3232

3333
@sharable private[this] var nextId = 0 // for debugging
3434

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
3636
case class ModuleDef(name: TermName, impl: Template)
3737
extends MemberDef {
3838
type ThisTree[-T >: Untyped] <: Trees.NameTree[T] with Trees.MemberDef[T] with ModuleDef
39-
def withName(name: Name)(implicit ctx: Context): untpd.ModuleDef = cpy.ModuleDef(this)(name.toTermName, impl)
39+
def withName(name: Name)(implicit ctx: Context): ModuleDef = cpy.ModuleDef(this)(name.toTermName, impl)
4040
}
4141

4242
case class ParsedTry(expr: Tree, handler: Tree, finalizer: Tree) extends TermTree
@@ -157,7 +157,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
157157
def toTypeFlags: Modifiers = withFlags(flags.toTypeFlags)
158158
def toTermFlags: Modifiers = withFlags(flags.toTermFlags)
159159

160-
def withFlags(flags: FlagSet): untpd.Modifiers =
160+
def withFlags(flags: FlagSet): Modifiers =
161161
if (this.flags == flags) this
162162
else copy(flags = flags)
163163

@@ -188,7 +188,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
188188
if (annots eq annotations) this
189189
else copy(annotations = annots)
190190

191-
def withPrivateWithin(pw: TypeName): untpd.Modifiers =
191+
def withPrivateWithin(pw: TypeName): Modifiers =
192192
if (pw.isEmpty) this
193193
else copy(privateWithin = pw)
194194

@@ -243,13 +243,13 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
243243
* from the symbol in this type. These type trees have marker trees
244244
* TypeRefOfSym or InfoOfSym as their originals.
245245
*/
246-
val References: Property.Key[List[DerivedTypeTree]] = new Property.Key[List[DerivedTypeTree]]
246+
val References: Property.Key[List[DerivedTypeTree]] = new Property.Key
247247

248248
/** Property key for TypeTrees marked with TypeRefOfSym or InfoOfSym
249249
* which contains the symbol of the original tree from which this
250250
* TypeTree is derived.
251251
*/
252-
val OriginalSymbol: Property.Key[Symbol] = new Property.Key[Symbol]
252+
val OriginalSymbol: Property.Key[Symbol] = new Property.Key
253253

254254
// ------ Creation methods for untyped only -----------------
255255

@@ -296,7 +296,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
296296
def DefDef(name: TermName, tparams: List[TypeDef], vparamss: List[List[ValDef]], tpt: Tree, rhs: LazyTree): DefDef = new DefDef(name, tparams, vparamss, tpt, rhs)
297297
def TypeDef(name: TypeName, rhs: Tree): TypeDef = new TypeDef(name, rhs)
298298
def Template(constr: DefDef, parents: List[Tree], self: ValDef, body: LazyTreeList): Template = new Template(constr, parents, self, body)
299-
def Import(expr: Tree, selectors: List[untpd.Tree]): Import = new Import(expr, selectors)
299+
def Import(expr: Tree, selectors: List[Tree]): Import = new Import(expr, selectors)
300300
def PackageDef(pid: RefTree, stats: List[Tree]): PackageDef = new PackageDef(pid, stats)
301301
def Annotated(arg: Tree, annot: Tree): Annotated = new Annotated(arg, annot)
302302

@@ -397,7 +397,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
397397
abstract class ModsDecorator { def mods: Modifiers }
398398

399399
implicit class modsDeco(val mdef: MemberDef)(implicit ctx: Context) {
400-
def mods: untpd.Modifiers = mdef.rawMods
400+
def mods: Modifiers = mdef.rawMods
401401
}
402402

403403
// --------- Copier/Transformer/Accumulator classes for untyped trees -----
@@ -416,7 +416,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
416416
}
417417
}.asInstanceOf[copied.ThisTree[Untyped]]
418418

419-
def ModuleDef(tree: Tree)(name: TermName, impl: Template): untpd.ModuleDef = tree match {
419+
def ModuleDef(tree: Tree)(name: TermName, impl: Template): ModuleDef = tree match {
420420
case tree: ModuleDef if (name eq tree.name) && (impl eq tree.impl) => tree
421421
case _ => finalize(tree, untpd.ModuleDef(name, impl))
422422
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class PathResolver(implicit ctx: Context) {
223223

224224
// Assemble the elements!
225225
// priority class path takes precedence
226-
def basis: List[Traversable[ClassPath]] = List[Traversable[ClassPath]](
226+
def basis: List[Traversable[ClassPath]] = List(
227227
classesInExpandedPath(priorityClassPath), // 0. The priority class path (for testing).
228228
JrtClassPath.apply(), // 1. The Java 9 classpath (backed by the jrt:/ virtual system, if available)
229229
classesInPath(javaBootClassPath), // 2. The Java bootstrap class path.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Properties extends PropertiesTrait {
1414

1515
/** Scala manifest attributes.
1616
*/
17-
@sharable val ScalaCompilerVersion: java.util.jar.Attributes.Name = new AttributeName("Scala-Compiler-Version")
17+
@sharable val ScalaCompilerVersion: AttributeName = new AttributeName("Scala-Compiler-Version")
1818
}
1919

2020
trait PropertiesTrait {

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import language.existentials
1616

1717
object Settings {
1818

19-
val BooleanTag: ClassTag[Boolean] = ClassTag.Boolean
20-
val IntTag: ClassTag[Int] = ClassTag.Int
21-
val StringTag: ClassTag[Nothing] = ClassTag(classOf[String])
22-
val ListTag: ClassTag[Nothing] = ClassTag(classOf[List[_]])
23-
val VersionTag: ClassTag[Nothing] = ClassTag(classOf[ScalaVersion])
24-
val OptionTag: ClassTag[Nothing] = ClassTag(classOf[Option[_]])
25-
val OutputTag: ClassTag[Nothing] = ClassTag(classOf[AbstractFile])
19+
val BooleanTag: ClassTag[Boolean] = ClassTag.Boolean
20+
val IntTag: ClassTag[Int] = ClassTag.Int
21+
val StringTag: ClassTag[String] = ClassTag(classOf[String])
22+
val ListTag: ClassTag[List[_]] = ClassTag(classOf[List[_]])
23+
val VersionTag: ClassTag[ScalaVersion] = ClassTag(classOf[ScalaVersion])
24+
val OptionTag: ClassTag[Option[_]] = ClassTag(classOf[Option[_]])
25+
val OutputTag: ClassTag[AbstractFile] = ClassTag(classOf[AbstractFile])
2626

2727
class SettingsState(initialValues: Seq[Any]) {
2828
private[this] var values = ArrayBuffer(initialValues: _*)
@@ -193,12 +193,12 @@ object Settings {
193193

194194
class SettingGroup {
195195

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

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

201-
def userSetSettings(state: SettingsState): Seq[Setting[T1] forSome { type T1 }] =
201+
def userSetSettings(state: SettingsState): Seq[Setting[_]] =
202202
allSettings filterNot (_.isDefaultIn(state))
203203

204204
def toConciseString(state: SettingsState): String =

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ object Annotations {
6565
override def symbol(implicit ctx: Context): ClassSymbol = defn.BodyAnnot
6666
override def derivedAnnotation(tree: Tree)(implicit ctx: Context): Annotation =
6767
if (tree eq this.tree) this else ConcreteBodyAnnotation(tree)
68-
override def arguments(implicit ctx: Context): Nil.type = Nil
68+
override def arguments(implicit ctx: Context): List[Tree] = Nil
6969
override def ensureCompleted(implicit ctx: Context): Unit = ()
7070
}
7171

@@ -90,7 +90,7 @@ object Annotations {
9090

9191
object Annotation {
9292

93-
def apply(tree: Tree): Annotations.ConcreteAnnotation = ConcreteAnnotation(tree)
93+
def apply(tree: Tree): ConcreteAnnotation = ConcreteAnnotation(tree)
9494

9595
def apply(cls: ClassSymbol)(implicit ctx: Context): Annotation =
9696
apply(cls, Nil)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ object Contexts {
8181
val base: ContextBase
8282

8383
/** All outer contexts, ending in `base.initialCtx` and then `NoContext` */
84-
def outersIterator: AnyRef with Iterator[Context] { var current: Context; } = new Iterator[Context] {
84+
def outersIterator: Iterator[Context] = new Iterator[Context] {
8585
var current = thiscontext
8686
def hasNext = current != NoContext
8787
def next = { val c = current; current = current.outer; c }
@@ -523,7 +523,7 @@ object Contexts {
523523
def setSetting[T](setting: Setting[T], value: T): this.type =
524524
setSettings(setting.updateIn(settingsState, value))
525525

526-
def setDebug: FreshContext = setSetting(base.settings.Ydebug, true)
526+
def setDebug: this.type = setSetting(base.settings.Ydebug, true)
527527
}
528528

529529
implicit class ModeChanges(val c: Context) extends AnyVal {
@@ -666,7 +666,7 @@ object Contexts {
666666
* instead of storing message computations directly in ErrorTypes in order
667667
* to avoid space leaks - the message computation usually captures a context.
668668
*/
669-
private[core] val errorTypeMsg: mutable.Map[Types.ErrorType, () => Message] = mutable.Map[ErrorType, () => Message]()
669+
private[core] val errorTypeMsg: mutable.Map[Types.ErrorType, () => Message] = mutable.Map()
670670

671671
// Phases state
672672

@@ -716,6 +716,6 @@ object Contexts {
716716
}
717717

718718
@sharable object EmptyGADTMap extends GADTMap(SimpleIdentityMap.Empty) {
719-
override def setBounds(sym: Symbol, b: TypeBounds): Nothing = unsupported("EmptyGADTMap.setBounds")
719+
override def setBounds(sym: Symbol, b: TypeBounds): Unit = unsupported("EmptyGADTMap.setBounds")
720720
}
721721
}

0 commit comments

Comments
 (0)