Skip to content

Commit da99c31

Browse files
committed
[wip, benchmarking] Remove DotClass
1 parent 297e9fc commit da99c31

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
@@ -14,7 +14,7 @@ import fromtasty.TASTYCompiler
1414
* process, but in most cases you only need to call [[process]] on the
1515
* existing object [[Main]].
1616
*/
17-
class Driver extends DotClass {
17+
class Driver {
1818

1919
protected def newCompiler(implicit ctx: Context): Compiler =
2020
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
@@ -821,7 +821,7 @@ object Trees {
821821

822822
// ----- Generic Tree Instances, inherited from `tpt` and `untpd`.
823823

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

826826
type Tree = Trees.Tree[T]
827827
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
@@ -693,7 +693,7 @@ object Contexts {
693693
// @sharable val theBase = new ContextBase // !!! DEBUG, so that we can use a minimal context for reporting even in code that normally cannot access a context
694694
}
695695

696-
class GADTMap(initBounds: SimpleIdentityMap[Symbol, TypeBounds]) extends util.DotClass {
696+
class GADTMap(initBounds: SimpleIdentityMap[Symbol, TypeBounds]) {
697697
private[this] var myBounds = initBounds
698698
def setBounds(sym: Symbol, b: TypeBounds): Unit =
699699
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
@@ -75,7 +75,7 @@ object Denotations {
7575
/** A PreDenotation represents a group of single denotations or a single multi-denotation
7676
* It is used as an optimization to avoid forming MultiDenotations too eagerly.
7777
*/
78-
abstract class PreDenotation extends util.DotClass {
78+
abstract class PreDenotation {
7979

8080
/** A denotation in the group exists */
8181
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
@@ -23,14 +23,14 @@ object NameKinds {
2323
@sharable private val uniqueNameKinds = new mutable.HashMap[String, UniqueNameKind]
2424

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

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

3535
/** The info class defined by this kind */
3636
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
@@ -32,7 +32,7 @@ object Names {
3232
/** A common superclass of Name and Symbol. After bootstrap, this should be
3333
* just the type alias Name | Symbol
3434
*/
35-
abstract class Designator extends util.DotClass
35+
abstract class Designator
3636

3737
/** A name if either a term name or a type name. Term names can be simple
3838
* 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
@@ -63,7 +63,7 @@ object Parsers {
6363
if (source.isSelfContained) new ScriptParser(source)
6464
else new Parser(source)
6565

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

6868
val in: ScannerCommon
6969

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
@@ -837,7 +837,7 @@ object RefChecks {
837837

838838
type LevelAndIndex = immutable.Map[Symbol, (LevelInfo, Int)]
839839

840-
class OptLevelInfo extends DotClass {
840+
class OptLevelInfo {
841841
def levelAndIndex: LevelAndIndex = Map()
842842
def enterReference(sym: Symbol, pos: Position): Unit = ()
843843
}

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
@@ -18,4 +18,8 @@ package object tools {
1818
}
1919
case _ => ys.isEmpty
2020
}
21+
22+
/** Throws an `UnsupportedOperationException` with the given method name. */
23+
def unsupported(methodName: String): Nothing =
24+
throw new UnsupportedOperationException(s"$getClass.$methodName")
2125
}

0 commit comments

Comments
 (0)