Skip to content

Commit

Permalink
Seals some case class hierarchies.
Browse files Browse the repository at this point in the history
  • Loading branch information
lexspoon committed Jun 26, 2013
1 parent be02dff commit 930b36d
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
Expand Up @@ -1747,7 +1747,7 @@ abstract class GenICode extends SubComponent {

/////////////////////// Context ////////////////////////////////

abstract class Cleanup(val value: AnyRef) {
sealed abstract class Cleanup(val value: AnyRef) {
def contains(x: AnyRef) = value == x
}
case class MonitorRelease(m: Local) extends Cleanup(m) { }
Expand Down
Expand Up @@ -27,7 +27,7 @@ abstract class CopyPropagation {
case object This extends Location

/** Values that can be on the stack. */
abstract class Value { }
sealed abstract class Value { }
case class Record(cls: Symbol, bindings: mutable.Map[Symbol, Value]) extends Value { }
/** The value of some location in memory. */
case class Deref(l: Location) extends Value
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/scala/tools/nsc/dependencies/Changes.scala
Expand Up @@ -16,7 +16,7 @@ abstract class Changes {
import compiler._
import symtab.Flags._

abstract class Change
sealed abstract class Change

private lazy val annotationsChecked =
List(definitions.SpecializedClass) // Any others that should be checked?
Expand All @@ -38,7 +38,7 @@ abstract class Changes {
/** An entity in source code, either a class or a member definition.
* Name is fully-qualified.
*/
abstract class Entity
sealed abstract class Entity
case class Class(name: String) extends Entity
case class Definition(name: String) extends Entity

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/settings/ScalaVersion.scala
Expand Up @@ -11,7 +11,7 @@ package tools.nsc.settings
* Represents a single Scala version in a manner that
* supports easy comparison and sorting.
*/
abstract class ScalaVersion extends Ordered[ScalaVersion] {
sealed abstract class ScalaVersion extends Ordered[ScalaVersion] {
def unparse: String
}

Expand Down
Expand Up @@ -79,7 +79,7 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
def chainBefore(next: Tree)(casegen: Casegen): Tree
}

trait NoNewBinders extends TreeMaker {
sealed trait NoNewBinders extends TreeMaker {
protected val localSubstitution: Substitution = EmptySubstitution
}

Expand All @@ -105,12 +105,12 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
override def toString = "S"+ localSubstitution
}

abstract class FunTreeMaker extends TreeMaker {
sealed abstract class FunTreeMaker extends TreeMaker {
val nextBinder: Symbol
def pos = nextBinder.pos
}

abstract class CondTreeMaker extends FunTreeMaker {
sealed abstract class CondTreeMaker extends FunTreeMaker {
val prevBinder: Symbol
val nextBinderTp: Type
val cond: Tree
Expand All @@ -126,7 +126,7 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
// unless we're optimizing, emit local variable bindings for all subpatterns of extractor/case class patterns
protected val debugInfoEmitVars = !settings.optimise.value

trait PreserveSubPatBinders extends TreeMaker {
sealed trait PreserveSubPatBinders extends TreeMaker {
val subPatBinders: List[Symbol]
val subPatRefs: List[Tree]
val ignoredSubPatBinders: Set[Symbol]
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
Expand Up @@ -21,13 +21,13 @@ trait ContextErrors {
import global._
import definitions._

abstract class AbsTypeError extends Throwable {
sealed abstract class AbsTypeError extends Throwable {
def errPos: Position
def errMsg: String
override def toString() = "[Type error at:" + errPos + "] " + errMsg
}

abstract class TreeTypeError extends AbsTypeError {
sealed abstract class TreeTypeError extends AbsTypeError {
def underlyingTree: Tree
def errPos = underlyingTree.pos
}
Expand Down
16 changes: 8 additions & 8 deletions src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
Expand Up @@ -259,7 +259,7 @@ trait MethodSynthesis {
* So it's important that creating an instance of Derived does not have a side effect,
* or if it has a side effect, control that it is done only once.
*/
trait Derived {
sealed trait Derived {

/** The tree from which we are deriving a synthetic member. Typically, that's
* given as an argument of the instance. */
Expand Down Expand Up @@ -288,7 +288,7 @@ trait MethodSynthesis {
def derivedTree: Tree
}

trait DerivedFromMemberDef extends Derived {
sealed trait DerivedFromMemberDef extends Derived {
def tree: MemberDef
def enclClass: Symbol

Expand All @@ -297,12 +297,12 @@ trait MethodSynthesis {
final def basisSym = tree.symbol
}

trait DerivedFromClassDef extends DerivedFromMemberDef {
sealed trait DerivedFromClassDef extends DerivedFromMemberDef {
def tree: ClassDef
final def enclClass = basisSym.owner.enclClass
}

trait DerivedFromValDef extends DerivedFromMemberDef {
sealed trait DerivedFromValDef extends DerivedFromMemberDef {
def tree: ValDef
final def enclClass = basisSym.enclClass

Expand Down Expand Up @@ -341,10 +341,10 @@ trait MethodSynthesis {
logDerived(derivedTree)
}
}
trait DerivedGetter extends DerivedFromValDef {
sealed trait DerivedGetter extends DerivedFromValDef {
// TODO
}
trait DerivedSetter extends DerivedFromValDef {
sealed trait DerivedSetter extends DerivedFromValDef {
override def isSetter = true
private def setterParam = derivedSym.paramss match {
case (p :: Nil) :: _ => p
Expand Down Expand Up @@ -378,7 +378,7 @@ trait MethodSynthesis {
def name: TermName = tree.name.toTermName
}

abstract class BaseGetter(tree: ValDef) extends DerivedGetter {
sealed abstract class BaseGetter(tree: ValDef) extends DerivedGetter {
def name = tree.name
def category = GetterTargetClass
def flagsMask = GetterFlags
Expand Down Expand Up @@ -510,7 +510,7 @@ trait MethodSynthesis {
def flagsExtra = 0
override def derivedSym = enclClass.info decl name
}
trait AnyBeanGetter extends BeanAccessor with DerivedGetter {
sealed trait AnyBeanGetter extends BeanAccessor with DerivedGetter {
def category = BeanGetterTargetClass
override def validate() {
if (derivedSym == NoSymbol) {
Expand Down
10 changes: 5 additions & 5 deletions src/library/scala/xml/dtd/Decl.scala
Expand Up @@ -12,9 +12,9 @@ package dtd

import Utility.sbToString

abstract class Decl
sealed abstract class Decl

abstract class MarkupDecl extends Decl {
sealed abstract class MarkupDecl extends Decl {
def buildString(sb: StringBuilder): StringBuilder
}

Expand Down Expand Up @@ -52,7 +52,7 @@ case class AttrDecl(name: String, tpe: String, default: DefaultDecl) {
}

/** an entity declaration */
abstract class EntityDecl extends MarkupDecl
sealed abstract class EntityDecl extends MarkupDecl

/** a parsed general entity declaration */
case class ParsedEntityDecl(name: String, entdef: EntityDef) extends EntityDecl {
Expand Down Expand Up @@ -85,7 +85,7 @@ case class NotationDecl( name:String, extID:ExternalID ) extends MarkupDecl {
}
}

abstract class EntityDef {
sealed abstract class EntityDef {
def buildString(sb: StringBuilder): StringBuilder
}

Expand Down Expand Up @@ -133,7 +133,7 @@ case class PEReference(ent:String) extends MarkupDecl {

// default declarations for attributes

abstract class DefaultDecl {
sealed abstract class DefaultDecl {
override def toString(): String
def buildString(sb: StringBuilder): StringBuilder
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/xml/dtd/ExternalID.scala
Expand Up @@ -15,7 +15,7 @@ package dtd
*
* @author Burak Emir
*/
abstract class ExternalID extends parsing.TokenTests {
sealed abstract class ExternalID extends parsing.TokenTests {
def quoted(s: String) = {
val c = if (s contains '"') '\'' else '"'
c + s + c
Expand Down
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/internal/AnnotationInfos.scala
Expand Up @@ -73,7 +73,7 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
* - arrays of constants
* - or nested classfile annotations
*/
abstract class ClassfileAnnotArg extends Product
sealed abstract class ClassfileAnnotArg extends Product
implicit val JavaArgumentTag = ClassTag[ClassfileAnnotArg](classOf[ClassfileAnnotArg])
case object UnmappableAnnotArg extends ClassfileAnnotArg

Expand Down
4 changes: 2 additions & 2 deletions src/scaladoc/scala/tools/nsc/doc/model/diagram/Diagram.scala
Expand Up @@ -10,7 +10,7 @@ import model._
* @author Damien Obrist
* @author Vlad Ureche
*/
abstract class Diagram {
sealed abstract class Diagram {
def nodes: List[Node]
def edges: List[(Node, List[Node])]
def isContentDiagram = false // Implemented by ContentDiagram
Expand Down Expand Up @@ -44,7 +44,7 @@ trait DepthInfo {
def maxDepth: Int
}

abstract class Node {
sealed abstract class Node {
def name = tpe.name
def tpe: TypeEntity
def tpl: Option[TemplateEntity]
Expand Down

0 comments on commit 930b36d

Please sign in to comment.