Skip to content

Commit 03b9887

Browse files
authored
Merge pull request #4545 from dotty-staging/opt/remove-DotClass
Remove DotClass
2 parents 67e2b6a + ecb69ee commit 03b9887

20 files changed

+28
-25
lines changed

compiler/src/dotty/tools/dotc/Driver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import fromtasty.TASTYCompiler
1616
* process, but in most cases you only need to call [[process]] on the
1717
* existing object [[Main]].
1818
*/
19-
class Driver extends DotClass {
19+
class Driver {
2020

2121
protected def newCompiler(implicit ctx: Context): Compiler =
2222
if (ctx.settings.fromTasty.value) new TASTYCompiler

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import core.StdNames.nme
1010

1111
/** A base class for things that have positions (currently: modifiers and trees)
1212
*/
13-
abstract class Positioned extends DotClass with Product {
13+
abstract class Positioned extends Product {
1414

1515
private[this] var curPos: Position = _
1616

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ object Trees {
853853

854854
// ----- Generic Tree Instances, inherited from `tpt` and `untpd`.
855855

856-
abstract class Instance[T >: Untyped <: Type] extends DotClass { inst =>
856+
abstract class Instance[T >: Untyped <: Type] { inst =>
857857

858858
type Tree = Trees.Tree[T]
859859
type TypTree = Trees.TypTree[T]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Properties._
1010

1111
import scala.collection.JavaConverters._
1212

13-
object CompilerCommand extends DotClass {
13+
object CompilerCommand {
1414

1515
/** The name of the command */
1616
def cmdName = "dotc"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ object Contexts {
710710
else assert(thread == Thread.currentThread(), "illegal multithreaded access to ContextBase")
711711
}
712712

713-
class GADTMap(initBounds: SimpleIdentityMap[Symbol, TypeBounds]) extends util.DotClass {
713+
class GADTMap(initBounds: SimpleIdentityMap[Symbol, TypeBounds]) {
714714
private[this] var myBounds = initBounds
715715
def setBounds(sym: Symbol, b: TypeBounds): Unit =
716716
myBounds = myBounds.updated(sym, b)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object Denotations {
7676
/** A PreDenotation represents a group of single denotations or a single multi-denotation
7777
* It is used as an optimization to avoid forming MultiDenotations too eagerly.
7878
*/
79-
abstract class PreDenotation extends util.DotClass {
79+
abstract class PreDenotation {
8080

8181
/** A denotation in the group exists */
8282
def exists: Boolean

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ object NameKinds {
2525
@sharable private val uniqueNameKinds = new mutable.HashMap[String, UniqueNameKind]
2626

2727
/** A class for the info stored in a derived name */
28-
abstract class NameInfo extends DotClass {
28+
abstract class NameInfo {
2929
def kind: NameKind
3030
def mkString(underlying: TermName): String
3131
def map(f: SimpleName => SimpleName): NameInfo = this
3232
}
3333

3434
/** An abstract base class of classes that define the kind of a derived name info */
35-
abstract class NameKind(val tag: Int) extends DotClass { self =>
35+
abstract class NameKind(val tag: Int) { self =>
3636

3737
/** The info class defined by this kind */
3838
type ThisInfo <: Info

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object Names {
3434
/** A common superclass of Name and Symbol. After bootstrap, this should be
3535
* just the type alias Name | Symbol
3636
*/
37-
abstract class Designator extends util.DotClass
37+
abstract class Designator
3838

3939
/** A name if either a term name or a type name. Term names can be simple
4040
* or derived. A simple term name is essentially an interned string stored

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import dotty.tools.dotc.util.DotClass
88
* run ids represent compiler runs
99
* phase ids represent compiler phases
1010
*/
11-
abstract class Periods extends DotClass { self: Context =>
11+
abstract class Periods { self: Context =>
1212
import Periods._
1313

1414
/** The current phase identifier */

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
package dotty.tools.dotc
1+
package dotty.tools
2+
package dotc
23
package core
34

45
import Periods._
@@ -263,7 +264,7 @@ object Phases {
263264
final def isAfterTyper(phase: Phase): Boolean = phase.id > typerPhase.id
264265
}
265266

266-
trait Phase extends DotClass {
267+
trait Phase {
267268

268269
/** A name given to the `Phase` that can be used to debug the compiler. For
269270
* instance, it is possible to print trees after a given phase using:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* @author Martin Odersky
44
*/
55

6-
package dotty.tools.dotc
6+
package dotty.tools
7+
package dotc
78
package core
89

910
import Symbols._
@@ -66,7 +67,7 @@ object Scopes {
6667
* or to delete them. These methods are provided by subclass
6768
* MutableScope.
6869
*/
69-
abstract class Scope extends DotClass with printing.Showable {
70+
abstract class Scope extends printing.Showable {
7071

7172
/** The last scope-entry from which all others are reachable via `prev` */
7273
private[dotc] def lastEntry: ScopeEntry

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import reporting.trace
1616

1717
/** Provides methods to compare types.
1818
*/
19-
class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
19+
class TypeComparer(initctx: Context) extends ConstraintHandling {
2020
import TypeComparer._
2121
implicit val ctx = initctx
2222

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ import TypeErasure._
343343
* @param wildcardOK Wildcards are acceptable (true when using the erasure
344344
* for computing a signature name).
345345
*/
346-
class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean, wildcardOK: Boolean) extends DotClass {
346+
class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean, wildcardOK: Boolean) {
347347

348348
/** The erasure |T| of a type T. This is:
349349
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ object Types {
8484
*
8585
* Note: please keep in sync with copy in `docs/docs/internals/type-system.md`.
8686
*/
87-
abstract class Type extends DotClass with Hashable with printing.Showable {
87+
abstract class Type extends Hashable with printing.Showable {
8888

8989
// ----- Tests -----------------------------------------------------
9090

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ object Parsers {
6464
if (source.isSelfContained) new ScriptParser(source)
6565
else new Parser(source)
6666

67-
abstract class ParserCommon(val source: SourceFile)(implicit ctx: Context) extends DotClass {
67+
abstract class ParserCommon(val source: SourceFile)(implicit ctx: Context) {
6868

6969
val in: ScannerCommon
7070

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
package dotty.tools.dotc
1+
package dotty.tools
2+
package dotc
23
package transform
34

45
import MegaPhase._

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ trait NamerContextOps { this: Context =>
102102
}
103103

104104
/** A new context for the interior of a class */
105-
def inClassContext(selfInfo: DotClass /* Should be Type | Symbol*/): Context = {
105+
def inClassContext(selfInfo: AnyRef /* Should be Type | Symbol*/): Context = {
106106
val localCtx: Context = ctx.fresh.setNewScope
107107
selfInfo match {
108108
case sym: Symbol if sym.exists && sym.name != nme.WILDCARD => localCtx.scope.openForMutations.enter(sym)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ object RefChecks {
843843

844844
type LevelAndIndex = immutable.Map[Symbol, (LevelInfo, Int)]
845845

846-
class OptLevelInfo extends DotClass {
846+
class OptLevelInfo {
847847
def levelAndIndex: LevelAndIndex = Map()
848848
def enterReference(sym: Symbol, pos: Position): Unit = ()
849849
}

compiler/src/dotty/tools/dotc/util/DotClass.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,4 @@ package dotty.tools.dotc.util
55
*/
66
class DotClass {
77

8-
/** Throws an `UnsupportedOperationException` with the given method name. */
9-
def unsupported(methodName: String): Nothing =
10-
throw new UnsupportedOperationException(s"$getClass.$methodName")
11-
128
}

compiler/src/dotty/tools/package.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ package object tools {
2020
}
2121
case _ => ys.isEmpty
2222
}
23+
24+
/** Throws an `UnsupportedOperationException` with the given method name. */
25+
def unsupported(methodName: String): Nothing =
26+
throw new UnsupportedOperationException(methodName)
2327
}

0 commit comments

Comments
 (0)