Skip to content

Remove DotClass #4545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/Driver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Positioned.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = _

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/config/CompilerCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Properties._

import scala.collection.JavaConverters._

object CompilerCommand extends DotClass {
object CompilerCommand {

/** The name of the command */
def cmdName = "dotc"
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Contexts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Denotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/NameKinds.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Names.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Periods.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Phases.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package dotty.tools.dotc
package dotty.tools
package dotc
package core

import Periods._
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Scopes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* @author Martin Odersky
*/

package dotty.tools.dotc
package dotty.tools
package dotc
package core

import Symbols._
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeErasure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 -----------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package dotty.tools.dotc
package dotty.tools
package dotc
package transform

import MegaPhase._
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ()
}
Expand Down
4 changes: 0 additions & 4 deletions compiler/src/dotty/tools/dotc/util/DotClass.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")

}
4 changes: 4 additions & 0 deletions compiler/src/dotty/tools/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}