diff --git a/compiler/src/dotty/tools/dotc/Driver.scala b/compiler/src/dotty/tools/dotc/Driver.scala index 327ee29756b4..804f5379e8f0 100644 --- a/compiler/src/dotty/tools/dotc/Driver.scala +++ b/compiler/src/dotty/tools/dotc/Driver.scala @@ -16,7 +16,7 @@ import fromtasty.TASTYCompiler * process, but in most cases you only need to call [[process]] on the * existing object [[Main]]. */ -class Driver extends DotClass { +class Driver { protected def newCompiler(implicit ctx: Context): Compiler = if (ctx.settings.fromTasty.value) new TASTYCompiler diff --git a/compiler/src/dotty/tools/dotc/ast/Positioned.scala b/compiler/src/dotty/tools/dotc/ast/Positioned.scala index bb4721cfd065..87d46eb9a9bf 100644 --- a/compiler/src/dotty/tools/dotc/ast/Positioned.scala +++ b/compiler/src/dotty/tools/dotc/ast/Positioned.scala @@ -10,7 +10,7 @@ import core.StdNames.nme /** A base class for things that have positions (currently: modifiers and trees) */ -abstract class Positioned extends DotClass with Product { +abstract class Positioned extends Product { private[this] var curPos: Position = _ diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index c2ce0f27a308..cf3b1359cfe6 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -853,7 +853,7 @@ object Trees { // ----- Generic Tree Instances, inherited from `tpt` and `untpd`. - abstract class Instance[T >: Untyped <: Type] extends DotClass { inst => + abstract class Instance[T >: Untyped <: Type] { inst => type Tree = Trees.Tree[T] type TypTree = Trees.TypTree[T] diff --git a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala index 12b19b472431..383c2aa9b906 100644 --- a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala +++ b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala @@ -10,7 +10,7 @@ import Properties._ import scala.collection.JavaConverters._ -object CompilerCommand extends DotClass { +object CompilerCommand { /** The name of the command */ def cmdName = "dotc" diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index cf4da2cba87a..d165e521dc17 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -710,7 +710,7 @@ object Contexts { else assert(thread == Thread.currentThread(), "illegal multithreaded access to ContextBase") } - class GADTMap(initBounds: SimpleIdentityMap[Symbol, TypeBounds]) extends util.DotClass { + class GADTMap(initBounds: SimpleIdentityMap[Symbol, TypeBounds]) { private[this] var myBounds = initBounds def setBounds(sym: Symbol, b: TypeBounds): Unit = myBounds = myBounds.updated(sym, b) diff --git a/compiler/src/dotty/tools/dotc/core/Denotations.scala b/compiler/src/dotty/tools/dotc/core/Denotations.scala index 82f071859a5d..2100db069eb0 100644 --- a/compiler/src/dotty/tools/dotc/core/Denotations.scala +++ b/compiler/src/dotty/tools/dotc/core/Denotations.scala @@ -76,7 +76,7 @@ object Denotations { /** A PreDenotation represents a group of single denotations or a single multi-denotation * It is used as an optimization to avoid forming MultiDenotations too eagerly. */ - abstract class PreDenotation extends util.DotClass { + abstract class PreDenotation { /** A denotation in the group exists */ def exists: Boolean diff --git a/compiler/src/dotty/tools/dotc/core/NameKinds.scala b/compiler/src/dotty/tools/dotc/core/NameKinds.scala index 5920b6b29af0..2c69f6339f1c 100644 --- a/compiler/src/dotty/tools/dotc/core/NameKinds.scala +++ b/compiler/src/dotty/tools/dotc/core/NameKinds.scala @@ -25,14 +25,14 @@ object NameKinds { @sharable private val uniqueNameKinds = new mutable.HashMap[String, UniqueNameKind] /** A class for the info stored in a derived name */ - abstract class NameInfo extends DotClass { + abstract class NameInfo { def kind: NameKind def mkString(underlying: TermName): String def map(f: SimpleName => SimpleName): NameInfo = this } /** An abstract base class of classes that define the kind of a derived name info */ - abstract class NameKind(val tag: Int) extends DotClass { self => + abstract class NameKind(val tag: Int) { self => /** The info class defined by this kind */ type ThisInfo <: Info diff --git a/compiler/src/dotty/tools/dotc/core/Names.scala b/compiler/src/dotty/tools/dotc/core/Names.scala index fc1774cfd4a9..3de657629fcb 100644 --- a/compiler/src/dotty/tools/dotc/core/Names.scala +++ b/compiler/src/dotty/tools/dotc/core/Names.scala @@ -34,7 +34,7 @@ object Names { /** A common superclass of Name and Symbol. After bootstrap, this should be * just the type alias Name | Symbol */ - abstract class Designator extends util.DotClass + abstract class Designator /** A name if either a term name or a type name. Term names can be simple * or derived. A simple term name is essentially an interned string stored diff --git a/compiler/src/dotty/tools/dotc/core/Periods.scala b/compiler/src/dotty/tools/dotc/core/Periods.scala index 3d4a288915d6..381593246495 100644 --- a/compiler/src/dotty/tools/dotc/core/Periods.scala +++ b/compiler/src/dotty/tools/dotc/core/Periods.scala @@ -8,7 +8,7 @@ import dotty.tools.dotc.util.DotClass * run ids represent compiler runs * phase ids represent compiler phases */ -abstract class Periods extends DotClass { self: Context => +abstract class Periods { self: Context => import Periods._ /** The current phase identifier */ diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index 3894ef445c47..0269c6f536ee 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -1,4 +1,5 @@ -package dotty.tools.dotc +package dotty.tools +package dotc package core import Periods._ @@ -263,7 +264,7 @@ object Phases { final def isAfterTyper(phase: Phase): Boolean = phase.id > typerPhase.id } - trait Phase extends DotClass { + trait Phase { /** A name given to the `Phase` that can be used to debug the compiler. For * instance, it is possible to print trees after a given phase using: diff --git a/compiler/src/dotty/tools/dotc/core/Scopes.scala b/compiler/src/dotty/tools/dotc/core/Scopes.scala index 25c52413bfe9..d4d6f6d734de 100644 --- a/compiler/src/dotty/tools/dotc/core/Scopes.scala +++ b/compiler/src/dotty/tools/dotc/core/Scopes.scala @@ -3,7 +3,8 @@ * @author Martin Odersky */ -package dotty.tools.dotc +package dotty.tools +package dotc package core import Symbols._ @@ -66,7 +67,7 @@ object Scopes { * or to delete them. These methods are provided by subclass * MutableScope. */ - abstract class Scope extends DotClass with printing.Showable { + abstract class Scope extends printing.Showable { /** The last scope-entry from which all others are reachable via `prev` */ private[dotc] def lastEntry: ScopeEntry diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 84400206a7b6..0f54da0573a2 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -16,7 +16,7 @@ import reporting.trace /** Provides methods to compare types. */ -class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { +class TypeComparer(initctx: Context) extends ConstraintHandling { import TypeComparer._ implicit val ctx = initctx diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala index 3e6f3f29d0ce..36cb45233771 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala @@ -343,7 +343,7 @@ import TypeErasure._ * @param wildcardOK Wildcards are acceptable (true when using the erasure * for computing a signature name). */ -class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean, wildcardOK: Boolean) extends DotClass { +class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean, wildcardOK: Boolean) { /** The erasure |T| of a type T. This is: * diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index e6b2b92d01d9..40b843cee067 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -84,7 +84,7 @@ object Types { * * Note: please keep in sync with copy in `docs/docs/internals/type-system.md`. */ - abstract class Type extends DotClass with Hashable with printing.Showable { + abstract class Type extends Hashable with printing.Showable { // ----- Tests ----------------------------------------------------- diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 18baba35ea6c..fc443e3c5367 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -64,7 +64,7 @@ object Parsers { if (source.isSelfContained) new ScriptParser(source) else new Parser(source) - abstract class ParserCommon(val source: SourceFile)(implicit ctx: Context) extends DotClass { + abstract class ParserCommon(val source: SourceFile)(implicit ctx: Context) { val in: ScannerCommon diff --git a/compiler/src/dotty/tools/dotc/transform/TransformByNameApply.scala b/compiler/src/dotty/tools/dotc/transform/TransformByNameApply.scala index c0825c7e8bea..1e8aa9c72278 100644 --- a/compiler/src/dotty/tools/dotc/transform/TransformByNameApply.scala +++ b/compiler/src/dotty/tools/dotc/transform/TransformByNameApply.scala @@ -1,4 +1,5 @@ -package dotty.tools.dotc +package dotty.tools +package dotc package transform import MegaPhase._ diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 2933c3dc92a5..f8d83964e82b 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -102,7 +102,7 @@ trait NamerContextOps { this: Context => } /** A new context for the interior of a class */ - def inClassContext(selfInfo: DotClass /* Should be Type | Symbol*/): Context = { + def inClassContext(selfInfo: AnyRef /* Should be Type | Symbol*/): Context = { val localCtx: Context = ctx.fresh.setNewScope selfInfo match { case sym: Symbol if sym.exists && sym.name != nme.WILDCARD => localCtx.scope.openForMutations.enter(sym) diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index e1d755db1b69..41b955c907bb 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -843,7 +843,7 @@ object RefChecks { type LevelAndIndex = immutable.Map[Symbol, (LevelInfo, Int)] - class OptLevelInfo extends DotClass { + class OptLevelInfo { def levelAndIndex: LevelAndIndex = Map() def enterReference(sym: Symbol, pos: Position): Unit = () } diff --git a/compiler/src/dotty/tools/dotc/util/DotClass.scala b/compiler/src/dotty/tools/dotc/util/DotClass.scala index cdb697a458d0..f9e7e97a219d 100644 --- a/compiler/src/dotty/tools/dotc/util/DotClass.scala +++ b/compiler/src/dotty/tools/dotc/util/DotClass.scala @@ -5,8 +5,4 @@ package dotty.tools.dotc.util */ class DotClass { - /** Throws an `UnsupportedOperationException` with the given method name. */ - def unsupported(methodName: String): Nothing = - throw new UnsupportedOperationException(s"$getClass.$methodName") - } diff --git a/compiler/src/dotty/tools/package.scala b/compiler/src/dotty/tools/package.scala index d0501e53fed8..aace5e3e7da1 100644 --- a/compiler/src/dotty/tools/package.scala +++ b/compiler/src/dotty/tools/package.scala @@ -20,4 +20,8 @@ package object tools { } case _ => ys.isEmpty } + + /** Throws an `UnsupportedOperationException` with the given method name. */ + def unsupported(methodName: String): Nothing = + throw new UnsupportedOperationException(methodName) }