summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-03-09 17:50:10 +0000
committerMartin Odersky <odersky@gmail.com>2006-03-09 17:50:10 +0000
commit0bef86d8e8b7ea7ebb790ebcec7fedcb9a24f5a8 (patch)
treea85a3276240467ad4994ae8f78174371e2a30ad1 /src/compiler/scala/tools
parentc0c963afaf40b85914eff3497e116763268e6aa7 (diff)
downloadscala-0bef86d8e8b7ea7ebb790ebcec7fedcb9a24f5a8.tar.gz
scala-0bef86d8e8b7ea7ebb790ebcec7fedcb9a24f5a8.tar.bz2
scala-0bef86d8e8b7ea7ebb790ebcec7fedcb9a24f5a8.zip
performed some renamings in the compiler & library
All -> Bottom AllRef -> Null mixin class -> trait
Diffstat (limited to 'src/compiler/scala/tools')
-rw-r--r--src/compiler/scala/tools/nsc/CompilationUnits.scala2
-rw-r--r--src/compiler/scala/tools/nsc/EvalLoop.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreePrinters.scala4
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala10
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala26
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala10
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Tokens.scala1
-rw-r--r--src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Members.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Primitives.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocUtil.scala2
-rw-r--r--src/compiler/scala/tools/nsc/models/Models.scala6
-rw-r--r--src/compiler/scala/tools/nsc/models/SemanticTokens.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Constants.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Flags.scala8
-rw-r--r--src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Scopes.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/StdNames.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala14
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala12
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Analyzer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Codification.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala13
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Variances.scala2
44 files changed, 98 insertions, 100 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala
index 30a4e77064..d22e3abfa5 100644
--- a/src/compiler/scala/tools/nsc/CompilationUnits.scala
+++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala
@@ -10,7 +10,7 @@ import scala.tools.nsc.util.FreshNameCreator;
import scala.tools.util.AbstractFile;
import scala.collection.mutable.HashSet;
-mixin class CompilationUnits requires Global {
+trait CompilationUnits requires Global {
class CompilationUnit(val source: SourceFile, val mixinOnly: boolean) {
diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala
index fc6c30f27a..12e9fdeb18 100644
--- a/src/compiler/scala/tools/nsc/EvalLoop.scala
+++ b/src/compiler/scala/tools/nsc/EvalLoop.scala
@@ -1,6 +1,6 @@
package scala.tools.nsc;
-mixin class EvalLoop {
+trait EvalLoop {
def prompt: String;
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
index d0ccc76479..3477a84f03 100644
--- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
@@ -118,9 +118,9 @@ abstract class TreePrinters {
case ClassDef(mods, name, tparams, tp, impl) =>
printAttributes(tree.symbol.attributes);
printModifiers(tree, mods);
- print("class " + symName(tree, name));
+ print((if (mods hasFlag TRAIT) "trait " else "class ") + symName(tree, name));
printTypeParams(tparams);
- printOpt(": ", tp); print(" extends "); print(impl);
+ printOpt("requires ", tp); print(" extends "); print(impl);
case PackageDef(packaged, stats) =>
print("package "); print(packaged); printColumn(stats, " {", ";", "}")
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index e95d41bdd6..763e53d606 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -12,7 +12,7 @@ import scala.tools.nsc.util.{Position,SourceFile};
import symtab.Flags._;
-mixin class Trees requires Global {
+trait Trees requires Global {
//statistics
var nodeCount = 0;
@@ -27,7 +27,7 @@ mixin class Trees requires Global {
def isCase = ((flags & CASE ) != 0);
def isSealed = ((flags & SEALED) != 0);
def isFinal = ((flags & FINAL ) != 0);
- def isMixin = ((flags & MIXIN ) != 0);
+ def isTrait = ((flags & TRAIT ) != 0);
def isPublic = !isPrivate && !isProtected;
def hasFlag(flag: int) = (flags & flag) != 0;
def | (flag: int): Modifiers = {
@@ -90,7 +90,7 @@ mixin class Trees requires Global {
}
}
- mixin class SymTree extends Tree {
+ trait SymTree extends Tree {
override def hasSymbol = true;
override var symbol: Symbol = NoSymbol;
}
@@ -100,11 +100,11 @@ mixin class Trees requires Global {
override def isDef = true;
}
- mixin class TermTree extends Tree {
+ trait TermTree extends Tree {
override def isTerm = true
}
- mixin class TypTree extends Tree {
+ trait TypTree extends Tree {
override def isType = true
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
index a74d6d4ba1..252288f750 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
@@ -11,7 +11,7 @@ import scala.tools.nsc.util.Position;
import scala.xml.{Text,TextBuffer};
-mixin class MarkupParsers requires SyntaxAnalyzer {
+trait MarkupParsers requires SyntaxAnalyzer {
import global._ ;
import posAssigner.atPos;
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index c02d59ce86..fe2eebb66a 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -38,7 +38,7 @@ import Tokens._;
* (4) Wraps naked case definitions in a match as follows:
* { cases } ==> (x => x.match {cases}), except when already argument to match
*/
-mixin class Parsers requires SyntaxAnalyzer {
+trait Parsers requires SyntaxAnalyzer {
import global._;
import posAssigner.atPos;
@@ -157,7 +157,7 @@ mixin class Parsers requires SyntaxAnalyzer {
def isDefIntro: boolean = in.token match {
case VAL | VAR | DEF | TYPE | OBJECT |
- CASEOBJECT | CLASS | CASECLASS | MIXIN | TRAIT => true
+ CASEOBJECT | CLASS | CASECLASS | TRAIT => true
case _ => false
}
@@ -324,8 +324,7 @@ mixin class Parsers requires SyntaxAnalyzer {
in.nextToken();
name
} else {
- if (settings.migrate.value &&
- in.token == REQUIRES || in.token == IMPLICIT || in.token == MIXIN)
+ if (settings.migrate.value && in.token == REQUIRES || in.token == IMPLICIT)
syntaxErrorMigrate(""+in+" is now a reserved word; cannot be used as identifier");
accept(IDENTIFIER);
nme.ERROR
@@ -852,7 +851,7 @@ mixin class Parsers requires SyntaxAnalyzer {
if (settings.migrate.value) {
if (in.token == MATCH)
syntaxErrorMigrate("`match' must be preceded by a selector expression")
- else if (in.token == REQUIRES || in.token == IMPLICIT || in.token == MIXIN)
+ else if (in.token == REQUIRES || in.token == IMPLICIT)
syntaxErrorMigrate(""+in+" is now a reserved word; cannot be used as identifier");
}
syntaxError("illegal start of simple expression", true);
@@ -1101,7 +1100,7 @@ mixin class Parsers requires SyntaxAnalyzer {
r
case _ =>
if (settings.migrate.value &&
- in.token == REQUIRES || in.token == IMPLICIT || in.token == MIXIN)
+ in.token == REQUIRES || in.token == IMPLICIT)
syntaxErrorMigrate(""+in+" is now a reserved word; cannot be used as identifier");
syntaxError("illegal start of simple pattern", true);
errorPatternTree
@@ -1575,15 +1574,11 @@ mixin class Parsers requires SyntaxAnalyzer {
/** TmplDef ::= [case] class ClassDef
* | [case] object ObjectDef
- * | ([mixin class | trait]) MixinClassDef
+ * | trait MixinClassDef
*/
def tmplDef(mods: Modifiers): Tree = in.token match {
case TRAIT =>
- classDef(mods | Flags.MIXIN | Flags.ABSTRACT);
- case MIXIN =>
- in.nextToken();
- if (in.token != CLASS) accept(CLASS);
- classDef(mods | Flags.MIXIN | Flags.ABSTRACT);
+ classDef(mods | Flags.TRAIT | Flags.ABSTRACT);
case CLASS =>
classDef(mods);
case CASECLASS =>
@@ -1609,7 +1604,7 @@ mixin class Parsers requires SyntaxAnalyzer {
val vparamss = paramClauses(name, implicitViews.toList, mods.hasFlag(Flags.CASE));
val thistpe = requiresTypeOpt();
val template = classTemplate(mods, name, vparamss);
- val mods1 = if (mods.hasFlag(Flags.MIXIN) && (template.body forall treeInfo.isInterfaceMember))
+ val mods1 = if (mods.hasFlag(Flags.TRAIT) && (template.body forall treeInfo.isInterfaceMember))
mods | Flags.INTERFACE
else mods;
ClassDef(mods1, name, tparams, thistpe, template)
@@ -1666,7 +1661,7 @@ mixin class Parsers requires SyntaxAnalyzer {
var body =
if (in.token == LBRACE) templateBody()
else { acceptEmptyTemplateBody("`{' expected"); List() }
- if (!mods.hasFlag(Flags.MIXIN)) Template(ps, vparamss, argss.toList, body)
+ if (!mods.hasFlag(Flags.TRAIT)) Template(ps, vparamss, argss.toList, body)
else Template(ps, body)
}
@@ -1721,7 +1716,6 @@ mixin class Parsers requires SyntaxAnalyzer {
} else if (in.token == CLASS ||
in.token == CASECLASS ||
in.token == TRAIT ||
- in.token == MIXIN ||
in.token == OBJECT ||
in.token == CASEOBJECT ||
in.token == LBRACKET ||
@@ -1800,7 +1794,7 @@ mixin class Parsers requires SyntaxAnalyzer {
case _ =>
false
}
- if (attrs exists isMixinAttribute) Flags.MIXIN else 0
+ if (attrs exists isMixinAttribute) Flags.TRAIT else 0
}
def joinAttributes(attrs: List[Tree], defs: List[Tree]): List[Tree] =
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 1266252ffd..a38153f28c 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -10,7 +10,7 @@ import scala.tools.nsc.util.{Position, SourceFile}
import SourceFile.{LF, FF, CR, SU}
import scala.tools.nsc.util.CharArrayReader
-mixin class Scanners requires SyntaxAnalyzer {
+trait Scanners requires SyntaxAnalyzer {
import global._
@@ -167,6 +167,13 @@ mixin class Scanners requires SyntaxAnalyzer {
next.copyFrom(this)
this.copyFrom(prev)
}
+ } else if (token == IDENTIFIER && name == nme.MIXINkw) { //todo: remove eventually
+ prev.copyFrom(this);
+ fetchToken();
+ if (token == CLASS)
+ unit.warning(pos, "`mixin' is no longer a reserved word; you should use `trait' instead of `mixin class'");
+ next.copyFrom(this)
+ this.copyFrom(prev)
}
if (afterLineEnd() && inLastOfStat(lastToken) && inFirstOfStat(token) &&
@@ -786,7 +793,6 @@ mixin class Scanners requires SyntaxAnalyzer {
enterKeyword(nme.IMPLICITkw, IMPLICIT)
enterKeyword(nme.IMPORTkw, IMPORT)
enterKeyword(nme.MATCHkw, MATCH)
- enterKeyword(nme.MIXINkw, MIXIN)
enterKeyword(nme.NEWkw, NEW)
enterKeyword(nme.NULLkw, NULL)
enterKeyword(nme.OBJECTkw, OBJECT)
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala b/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala
index 2f07497ede..b99ee08811 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Tokens.scala
@@ -67,7 +67,6 @@ object Tokens {
final val RETURN = 57;
final val MATCH = 58;
final val REQUIRES = 59;
- final val MIXIN = 60;
/** special symbols */
final val COMMA = 61;
diff --git a/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala b/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala
index 3a13767900..d6b81a84fe 100644
--- a/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala
+++ b/src/compiler/scala/tools/nsc/backend/WorklistAlgorithm.scala
@@ -22,7 +22,7 @@ import scala.collection.mutable.MutableList;
*
* @see scala.tools.nsc.backend.icode.Linearizers
*/
-mixin class WorklistAlgorithm {
+trait WorklistAlgorithm {
type Elem;
type WList <: MutableList[Elem];
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index aa42da4273..0c9d6dc2c3 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -11,7 +11,7 @@ import scala.tools.nsc.ast._;
import scala.collection.mutable.Map;
import scala.tools.nsc.util.Position;
-mixin class BasicBlocks requires ICodes {
+trait BasicBlocks requires ICodes {
import opcodes._;
/** This class represents a basic block. Each
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
index 1e80d0eac0..aa20ecb932 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
@@ -17,7 +17,7 @@ import scala.collection.mutable.HashSet;
* all our handlers will catch `Throwable' and rely on proper ordering
* in the generated code to preserve nesting.
*/
-mixin class ExceptionHandlers requires ICodes {
+trait ExceptionHandlers requires ICodes {
import global.{Symbol, NoSymbol};
class ExceptionHandler(val method: IMethod, label: String, val cls: Symbol) {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
index c0b6ada3c3..ff4a2d4a0a 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
@@ -10,7 +10,7 @@ package scala.tools.nsc.backend.icode;
import scala.tools.nsc.ast._;
import scala.collection.mutable.{Stack, HashSet};
-mixin class Linearizers requires ICodes {
+trait Linearizers requires ICodes {
import opcodes._;
abstract class Linearizer {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
index 02af695f37..e9e6445185 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
@@ -13,7 +13,7 @@ import scala.{Symbol => scala_Symbol};
import scala.tools.nsc.symtab.Flags;
-mixin class Members requires ICodes {
+trait Members requires ICodes {
import global._;
/**
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala
index 57fa0ff327..912358762c 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala
@@ -48,7 +48,7 @@ import scala.tools.nsc.util.Position;
* erased types of Scala and references Symbols to refer named entities
* in the source files.
*/
-mixin class Opcodes requires ICodes {
+trait Opcodes requires ICodes {
import global.{Symbol, NoSymbol, Type, Name, Constant};
/** This class represents an instruction of the intermediate code.
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala
index b134819853..c07b7b0829 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala
@@ -9,7 +9,7 @@ package scala.tools.nsc.backend.icode;
import java.io.PrintWriter;
-mixin class Primitives requires ICodes {
+trait Primitives requires ICodes {
/** This class represents a primitive operation. */
class Primitive {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
index 362aeb9100..ce2895c8c7 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -25,7 +25,7 @@ package scala.tools.nsc.backend.icode;
import scala.collection.mutable.{Map, HashMap};
-mixin class TypeKinds requires ICodes {
+trait TypeKinds requires ICodes {
import global._;
/** This class represents a type kind. Type kinds
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
index 6aa8507c57..69f1f34cb7 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
@@ -9,7 +9,7 @@ package scala.tools.nsc.backend.icode;
import scala.tools.nsc.backend.icode.Primitives;
-mixin class TypeStacks requires ICodes {
+trait TypeStacks requires ICodes {
import opcodes._;
import global.{Symbol, Type, definitions};
diff --git a/src/compiler/scala/tools/nsc/doc/DocUtil.scala b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
index c88b1cac35..e7a0d6cf88 100644
--- a/src/compiler/scala/tools/nsc/doc/DocUtil.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
@@ -26,7 +26,7 @@ object DocUtil {
nodes.concat(x)
}
- mixin class UrlContext {
+ trait UrlContext {
def relative: String
def aref(href0: String, target: String, text: String): NodeSeq = {
diff --git a/src/compiler/scala/tools/nsc/models/Models.scala b/src/compiler/scala/tools/nsc/models/Models.scala
index f89e2da145..65eb769d67 100644
--- a/src/compiler/scala/tools/nsc/models/Models.scala
+++ b/src/compiler/scala/tools/nsc/models/Models.scala
@@ -47,7 +47,7 @@ abstract class Models {
if (mods . isCase ) modString = "case" :: modString;
if (mods . isSealed ) modString = "sealed" :: modString;
if (mods . isFinal ) modString = "final" :: modString;
- if (mods . isMixin ) modString = "mixin" :: modString;
+ if (mods . isTrait ) modString = "mixin" :: modString;
modString;
}
@@ -161,7 +161,7 @@ abstract class Models {
def treex = tree.asInstanceOf[PackageDef];
}
- mixin class Composite extends Model {
+ trait Composite extends Model {
import scala.collection.mutable._;
@@ -245,7 +245,7 @@ abstract class Models {
}
abstract class MemberComposite(parent0: Composite) extends MemberMod(parent0) with Composite;
- mixin class HasClassObjects extends Composite {
+ trait HasClassObjects extends Composite {
override def isMember(tree : Tree) : Boolean = (super.isMember(tree) ||
(tree.isInstanceOf[ImplDef]));
}
diff --git a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
index ef8f60e6c8..c345226633 100644
--- a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
+++ b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
@@ -50,12 +50,12 @@ class SemanticTokens(val compiler: Global) {
else pos;
}
- mixin class HasNext extends Token {
+ trait HasNext extends Token {
var next0: HasPrev = _;
def next = next0;
}
- mixin class HasPrev extends Token {
+ trait HasPrev extends Token {
var prev0: HasNext = _;
def prev = prev0;
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Constants.scala b/src/compiler/scala/tools/nsc/symtab/Constants.scala
index 48a0c0bdf0..263a02a46a 100644
--- a/src/compiler/scala/tools/nsc/symtab/Constants.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Constants.scala
@@ -9,7 +9,7 @@ package scala.tools.nsc.symtab;
import classfile.PickleFormat._;
-mixin class Constants requires SymbolTable {
+trait Constants requires SymbolTable {
import definitions._;
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 4d2c3466f9..81a9448ddd 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -9,7 +9,7 @@ import scala.tools.nsc.util.Position;
import collection.mutable.HashMap;
import Flags._;
-mixin class Definitions requires SymbolTable {
+trait Definitions requires SymbolTable {
object definitions {
def isDefinitionsInitialized = isInitialized;
@@ -318,10 +318,10 @@ mixin class Definitions requires SymbolTable {
AnyRefClass = newAlias(ScalaPackageClass, "AnyRef", ObjectClass.typeConstructor);
AllRefClass = newClass(ScalaPackageClass, "AllRef", List(AnyRefClass.typeConstructor))
- .setFlag(ABSTRACT | MIXIN | FINAL);
+ .setFlag(ABSTRACT | TRAIT | FINAL);
AllClass = newClass(ScalaPackageClass, "All", List(AnyClass.typeConstructor))
- .setFlag(ABSTRACT | MIXIN | FINAL);
+ .setFlag(ABSTRACT | TRAIT | FINAL);
StringClass = getClass("java.lang.String");
ThrowableClass = getClass("java.lang.Throwable");
diff --git a/src/compiler/scala/tools/nsc/symtab/Flags.scala b/src/compiler/scala/tools/nsc/symtab/Flags.scala
index 2c9bc04b69..d54a12159b 100644
--- a/src/compiler/scala/tools/nsc/symtab/Flags.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Flags.scala
@@ -48,7 +48,7 @@ object Flags {
final val STATIC = 0x00800000; // static field, method or class
final val CASEACCESSOR = 0x01000000; // symbol is a case parameter (or its accessor)
- final val MIXIN = 0x02000000; // symbol is a mixin class
+ final val TRAIT = 0x02000000; // symbol is a trait
final val BRIDGE = 0x04000000; // function is a bridge method. Set by Erasure
final val ACCESSOR = 0x08000000; // a value or variable accessor
@@ -99,8 +99,8 @@ object Flags {
final val TopLevelCreationFlags =
MODULE | PACKAGE | FINAL | JAVA;
- final val ExplicitFlags = // these modifiers can be set explicitly in source programs.
- PRIVATE | PROTECTED | ABSTRACT | MIXIN | FINAL | SEALED | OVERRIDE | CASE | IMPLICIT | ABSOVERRIDE;
+ final val ExplicitFlags = // these modifiers can be set explicitly in source programs.
+ PRIVATE | PROTECTED | ABSTRACT | FINAL | SEALED | OVERRIDE | CASE | IMPLICIT | ABSOVERRIDE;
final val PrintableFlags = // these modifiers appear in TreePrinter output.
(ExplicitFlags | LOCAL | SYNTHETIC | STABLE | CASEACCESSOR | ACCESSOR |
@@ -161,7 +161,7 @@ object Flags {
case STATIC => "<static>"
case CASEACCESSOR => "<caseaccessor>"
- case MIXIN => "mixin"
+ case TRAIT => "<trait>"
case BRIDGE => "<bridge>"
case ACCESSOR => "<accessor>"
diff --git a/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala b/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala
index 87f4ba7b12..bf01d4419a 100644
--- a/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala
+++ b/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala
@@ -5,7 +5,7 @@
// $Id$
package scala.tools.nsc.symtab;
-mixin class InfoTransformers requires SymbolTable {
+trait InfoTransformers requires SymbolTable {
abstract class InfoTransformer {
var prev: InfoTransformer = this;
diff --git a/src/compiler/scala/tools/nsc/symtab/Scopes.scala b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
index 921d9f9cc0..a0f577c9a5 100644
--- a/src/compiler/scala/tools/nsc/symtab/Scopes.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
@@ -5,7 +5,7 @@
// $Id$
package scala.tools.nsc.symtab;
-mixin class Scopes requires SymbolTable {
+trait Scopes requires SymbolTable {
class ScopeEntry(val sym: Symbol, val owner: Scope) {
diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
index 3bf7478a49..17f94dee33 100644
--- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala
+++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
@@ -7,7 +7,7 @@ package scala.tools.nsc.symtab;
import scala.tools.nsc.util.NameTransformer;
-mixin class StdNames requires SymbolTable {
+trait StdNames requires SymbolTable {
object nme {
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index ea85974721..a327a0e053 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -10,7 +10,7 @@ import scala.tools.util.AbstractFile;
import scala.tools.nsc.util.{Position, SourceFile};
import Flags._;
-mixin class Symbols requires SymbolTable {
+trait Symbols requires SymbolTable {
import definitions._;
private var ids = 0;
@@ -174,7 +174,7 @@ mixin class Symbols requires SymbolTable {
final def isThisSym = isTerm && name == nme.this_;
final def isThisSkolem = isTerm && deSkolemize != this;
final def isError = hasFlag(IS_ERROR);
- final def isMixin = isClass & hasFlag(MIXIN);
+ final def isTrait = isClass & hasFlag(TRAIT);
final def isAliasType = isType && !isClass && !hasFlag(DEFERRED);
final def isAbstractType = isType && !isClass && hasFlag(DEFERRED);
final def isTypeParameterOrSkolem = isType && hasFlag(PARAM);
@@ -202,11 +202,11 @@ mixin class Symbols requires SymbolTable {
final def isImplClass: boolean = isClass && hasFlag(IMPLCLASS);
final def needsImplClass: boolean =
- isMixin && (!hasFlag(INTERFACE) || hasFlag(lateINTERFACE)) && !isImplClass;
+ isTrait && (!hasFlag(INTERFACE) || hasFlag(lateINTERFACE)) && !isImplClass;
final def isImplOnly: boolean = (
hasFlag(PRIVATE) ||
- (owner.isImplClass || owner.isMixin) &&
+ (owner.isImplClass || owner.isTrait) &&
(hasFlag(notPRIVATE | LIFTED) && !hasFlag(ACCESSOR | SUPERACCESSOR) ||
isConstructor)
);
@@ -532,7 +532,7 @@ mixin class Symbols requires SymbolTable {
/** The primary constructor of a class */
def primaryConstructor: Symbol = {
- val c = info.decl(if (isMixin || isImplClass) nme.MIXIN_CONSTRUCTOR else nme.CONSTRUCTOR);
+ val c = info.decl(if (isTrait || isImplClass) nme.MIXIN_CONSTRUCTOR else nme.CONSTRUCTOR);
if (c hasFlag OVERLOADED) c.alternatives.head else c
}
@@ -709,7 +709,8 @@ mixin class Symbols requires SymbolTable {
/** String representation of symbol's definition key word */
final def keyString: String =
- if (isMixin && hasFlag(JAVA)) "interface"
+ if (isTrait && hasFlag(JAVA)) "interface"
+ else if (isTrait) "trait"
else if (isClass) "class"
else if (isType && !hasFlag(PARAM)) "type"
else if (isVariable) "var"
@@ -726,6 +727,7 @@ mixin class Symbols requires SymbolTable {
else if (isAnonymousClass) "<template>"
else if (isRefinementClass) ""
else if (isModuleClass) "singleton class"
+ else if (isTrait) "trait"
else if (isClass) "class"
else if (isType) "type"
else if (isVariable) "variable"
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 2b4be691c9..2ddb95018c 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -30,7 +30,7 @@ import Flags._;
case TypeVar(_, _) =>
*/
-mixin class Types requires SymbolTable {
+trait Types requires SymbolTable {
import definitions._;
//statistics
@@ -425,7 +425,7 @@ mixin class Types requires SymbolTable {
// Subclasses ------------------------------------------------------------
- mixin class UniqueType {
+ trait UniqueType {
private val hashcode = { val h = super.hashCode(); if (h < 0) -h else h }
override def hashCode() = hashcode;
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 29360f3ab1..4b7fe373c2 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -604,7 +604,7 @@ abstract class ClassfileParser {
if ((flags & JAVA_ACC_FINAL) != 0)
res = res | FINAL;
if ((flags & JAVA_ACC_INTERFACE) != 0)
- res = res | MIXIN | INTERFACE | ABSTRACT;
+ res = res | TRAIT | INTERFACE | ABSTRACT;
if ((flags & JAVA_ACC_SYNTHETIC) != 0)
res = res | SYNTHETIC;
if ((flags & JAVA_ACC_STATIC) != 0)
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index e6110d3976..1e4be38767 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -115,7 +115,7 @@ abstract class AddInterfaces extends InfoTransform {
val parents1 =
if (parents.isEmpty) List()
else {
- assert(!parents.head.symbol.isMixin || clazz == RepeatedParamClass, clazz);
+ assert(!parents.head.symbol.isTrait || clazz == RepeatedParamClass, clazz);
if (clazz hasFlag INTERFACE) erasedTypeRef(ObjectClass) :: parents.tail
else if (clazz.isImplClass || clazz == ArrayClass) parents
else parents map mixinToImplClass
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 68dfc794f4..ea474a68bb 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -529,7 +529,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
*/
def addBridges(stats: List[Tree], base: Symbol): List[Tree] =
- if (base.isMixin) stats
+ if (base.isTrait) stats
else {
val bridges = bridgeDefs(base);
if (bridges.isEmpty) stats else stats ::: bridges
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index bb9b34d177..4f71be7b62 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -39,9 +39,9 @@ abstract class ExplicitOuter extends InfoTransform {
def transformInfo(sym: Symbol, tp: Type): Type = tp match {
case MethodType(formals, restpe) =>
//todo: needed?
- if (sym.owner.isMixin && (sym hasFlag SUPERACCESSOR))
+ if (sym.owner.isTrait && (sym hasFlag SUPERACCESSOR))
sym.makeNotPrivate(sym.owner);
- if (sym.owner.isMixin && (sym hasFlag PROTECTED)) sym setFlag notPROTECTED;
+ if (sym.owner.isTrait && (sym hasFlag PROTECTED)) sym setFlag notPROTECTED;
if (sym.isConstructor && !isStatic(sym.owner))
MethodType(formals ::: List(outerClass(sym.owner).toInterface.thisType), restpe)
else tp;
@@ -51,7 +51,7 @@ abstract class ExplicitOuter extends InfoTransform {
if (!isStatic(clazz)) {
decls1 = new Scope(decls1.toList);
val outerAcc = clazz.newMethod(clazz.pos, nme.OUTER);
- if (clazz.isMixin || (decls.toList exists (.isClass)))
+ if (clazz.isTrait || (decls.toList exists (.isClass)))
outerAcc.expandName(clazz);
decls1 enter (
outerAcc setFlag (PARAMACCESSOR | ACCESSOR | STABLE)
@@ -60,7 +60,7 @@ abstract class ExplicitOuter extends InfoTransform {
setFlag (LOCAL | PRIVATE | PARAMACCESSOR | (outerAcc getFlag EXPANDEDNAME))
setInfo outerClass(clazz).thisType);
}
- if (clazz.isMixin) {
+ if (clazz.isTrait) {
decls1 = new Scope(decls1.toList);
decls1 enter makeMixinConstructor(clazz);
}
@@ -258,7 +258,7 @@ abstract class ExplicitOuter extends InfoTransform {
if (!(currentOwner hasFlag INTERFACE) || (currentOwner hasFlag lateINTERFACE)) {
if (!isStatic(currentOwner))
decls1 = decls1 ::: outerDefs(currentOwner); // (1)
- if (currentOwner.isMixin)
+ if (currentOwner.isTrait)
decls1 = decls1 ::: List(mixinConstructorDef(currentOwner)) // (2)
}
localTyper = savedLocalTyper;
@@ -327,7 +327,7 @@ abstract class ExplicitOuter extends InfoTransform {
val tree1 = super.transform(tree);
tree1 match {
case DefDef(_, _, _, _, _, _) =>
- if (sym.owner.isMixin && (sym hasFlag (ACCESSOR | SUPERACCESSOR)))
+ if (sym.owner.isTrait && (sym hasFlag (ACCESSOR | SUPERACCESSOR)))
sym.makeNotPrivate(sym.owner); //(2)
tree1
case Select(qual, name) =>
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 8ad57a5bad..0802e00359 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -101,7 +101,7 @@ abstract class Mixin extends InfoTransform {
def addMixedinMembers(clazz: Symbol): unit = {
if (!(clazz hasFlag MIXEDIN) && (clazz != ObjectClass)) {
- assert(!clazz.isMixin, clazz);
+ assert(!clazz.isTrait, clazz);
clazz setFlag MIXEDIN;
assert(!clazz.info.parents.isEmpty, clazz);
val superclazz = clazz.info.parents.head.symbol;
@@ -216,7 +216,7 @@ abstract class Mixin extends InfoTransform {
case Template(parents, body) =>
localTyper = erasure.newTyper(rootContext.make(tree, currentOwner));
atPhase(phase.next)(currentOwner.owner.info);//needed?
- if (!currentOwner.isMixin) addMixedinMembers(currentOwner)
+ if (!currentOwner.isTrait) addMixedinMembers(currentOwner)
else if (currentOwner hasFlag lateINTERFACE) addLateInterfaceMembers(currentOwner);
tree
case DefDef(mods, name, tparams, List(vparams), tpt, rhs) if currentOwner.isImplClass =>
@@ -300,7 +300,7 @@ abstract class Mixin extends InfoTransform {
if (sym hasFlag MIXEDIN) {
if (clazz hasFlag lateINTERFACE) {
addDefDef(sym, vparamss => EmptyTree)
- } else if (!clazz.isMixin) {
+ } else if (!clazz.isTrait) {
if (sym hasFlag ACCESSOR) {
addDefDef(sym, vparams => {
val accessedRef = sym.tpe match {
@@ -325,7 +325,7 @@ abstract class Mixin extends InfoTransform {
}
}
val stats1 = add(stats, newDefs.toList);
- if (clazz.isMixin) stats1 else stats1 map completeSuperAccessor;
+ if (clazz.isTrait) stats1 else stats1 map completeSuperAccessor;
}
private def postTransform(tree: Tree): Tree = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
index ed7382dc8a..ed76cb6b91 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Analyzer.scala
@@ -7,7 +7,7 @@ package scala.tools.nsc.typechecker;
/** The main attribution phase.
*/
-mixin class Analyzer
+trait Analyzer
extends AnyRef
with Contexts
with Namers
diff --git a/src/compiler/scala/tools/nsc/typechecker/Codification.scala b/src/compiler/scala/tools/nsc/typechecker/Codification.scala
index b7383fce5b..6a802d7c31 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Codification.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Codification.scala
@@ -11,7 +11,7 @@ import scala.collection.immutable.ListMap;
import scala.collection.mutable.ListBuffer;
import scala.tools.nsc.util.FreshNameCreator;
-mixin class Codification requires Analyzer {
+trait Codification requires Analyzer {
import global._;
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index ba35ebbb4b..0da9ee6177 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -8,7 +8,7 @@ package scala.tools.nsc.typechecker;
import symtab.Flags._;
import scala.tools.nsc.util.Position;
-mixin class Contexts requires Analyzer {
+trait Contexts requires Analyzer {
import global._;
val NoContext = new Context {
diff --git a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
index 28bbff53c2..de70ccf5a7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
@@ -8,7 +8,7 @@ package scala.tools.nsc.typechecker;
import scala.collection.mutable.ListBuffer;
import symtab.Flags._;
-mixin class EtaExpansion requires Analyzer {
+trait EtaExpansion requires Analyzer {
import global._;
import posAssigner.atPos;
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 467b7b7465..1004b4b67d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -8,7 +8,7 @@ package scala.tools.nsc.typechecker;
import scala.collection.mutable.ListBuffer;
import symtab.Flags._;
-mixin class Infer requires Analyzer {
+trait Infer requires Analyzer {
import global._;
import definitions._;
import posAssigner.atPos;
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 8668afae91..1b191da676 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -10,7 +10,7 @@ import symtab.Flags;
import symtab.Flags._;
/** Methods to create symbols and to enter them into scopes. */
-mixin class Namers requires Analyzer {
+trait Namers requires Analyzer {
import global._;
import definitions._;
@@ -544,15 +544,13 @@ mixin class Namers requires Analyzer {
Flags.flagsToString(flag1) + " and " + Flags.flagsToString(flag2));
if (sym.hasFlag(IMPLICIT) && !sym.isTerm)
context.error(sym.pos, "`implicit' modifier can be used only for values, variables and methods");
- if (sym.hasFlag(MIXIN) && !sym.isClass)
- context.error(sym.pos, "`mixin' modifier can be used only for classes");
if (sym.hasFlag(ABSTRACT) && !sym.isClass)
context.error(sym.pos, "`abstract' modifier can be used only for classes; " +
"\nit should be omitted for abstract members");
if (sym.hasFlag(OVERRIDE | ABSOVERRIDE) && sym.isClass)
context.error(sym.pos, "`override' modifier not allowed for classes");
- if (sym.hasFlag(ABSOVERRIDE) && !sym.owner.isMixin)
- context.error(sym.pos, "`abstract override' modifier only allowed for members of mixin classes");
+ if (sym.hasFlag(ABSOVERRIDE) && !sym.owner.isTrait)
+ context.error(sym.pos, "`abstract override' modifier only allowed for members of traits");
if (sym.info.symbol == FunctionClass(0) &&
sym.isValueParameter && sym.owner.isClass && sym.owner.hasFlag(CASE))
context.error(sym.pos, "pass-by-name arguments not allowed for case class parameters");
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 5af2caf977..41cfdf30bf 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -230,7 +230,7 @@ abstract class RefChecks extends InfoTransform {
}
*/
// 2. Check that only abstract classes have deferred members
- if (clazz.isClass && !clazz.isMixin) {
+ if (clazz.isClass && !clazz.isTrait) {
def abstractClassError(mustBeMixin: boolean, msg: String): unit = {
unit.error(clazz.pos,
(if (clazz.isAnonymousClass || clazz.isModuleClass) "object creation impossible"
@@ -464,12 +464,12 @@ abstract class RefChecks extends InfoTransform {
val ddef =
atPhase(phase.next) {
localTyper.typed {
- if (sym.owner.isMixin) newModuleAccessDcl(sym)
+ if (sym.owner.isTrait) newModuleAccessDcl(sym)
else newModuleAccessDef(sym, vdef.symbol)
}
}
- if (sym.owner.isMixin) transformTrees(List(cdef, ddef))
+ if (sym.owner.isTrait) transformTrees(List(cdef, ddef))
else transformTrees(List(cdef, vdef, ddef))
}
@@ -597,7 +597,7 @@ abstract class RefChecks extends InfoTransform {
unit.error(tree.pos, "symbol accessed from super may not be abstract");
}
//System.out.println("super: " + tree + " in " + base);//DEBUG
- if (base.isMixin && sym.isTerm && mix == nme.EMPTY.toTypeName) {
+ if (base.isTrait && sym.isTerm && mix == nme.EMPTY.toTypeName) {
val superAccName = nme.superName(sym.name);
val superAcc = base.info.decl(superAccName) suchThat (.alias.==(sym));
assert(superAcc != NoSymbol, "" + sym + " " + base + " " + superAccName);//debug
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 7e0562d633..4eb38f349b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -46,7 +46,7 @@ abstract class SuperAccessors extends transform.Transform {
case Select(sup @ Super(_, mix), name) =>
val clazz = sup.symbol;
if (tree.isTerm && mix == nme.EMPTY.toTypeName &&
- (clazz.isMixin || clazz != currentOwner.enclClass || !validCurrentOwner)) {
+ (clazz.isTrait || clazz != currentOwner.enclClass || !validCurrentOwner)) {
val supername = nme.superName(tree.symbol.name);
var superAcc = clazz.info.decl(supername).suchThat(.alias.==(tree.symbol));
if (superAcc == NoSymbol) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index b2268ff239..306dad37c6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -18,7 +18,7 @@ import scala.collection.mutable.ListBuffer;
* unless they are defined in the class or a baseclass
* different from java.lang.Object
*/
-mixin class SyntheticMethods requires Analyzer {
+trait SyntheticMethods requires Analyzer {
import global._; // the global environment
import definitions._; // standard classes and methods
import typer.{typed}; // methods to type trees
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 10c96ac749..4482480496 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -11,7 +11,7 @@ import scala.tools.nsc.util.Position
import scala.collection.mutable.{HashMap, ListBuffer}
/** Methods to create symbols and to enter them into scopes. */
-mixin class Typers requires Analyzer {
+trait Typers requires Analyzer {
import global._
import definitions._
import posAssigner.atPos
@@ -510,8 +510,8 @@ mixin class Typers requires Analyzer {
else {
var supertpt = typedTypeConstructor(templ.parents.head)
var mixins = templ.parents.tail map typedType
- // If first parent is a mixin class, make it first mixin and add its superclass as first parent
- while (supertpt.tpe.symbol != null && supertpt.tpe.symbol.initialize.isMixin) {
+ // If first parent is a trait, make it first mixin and add its superclass as first parent
+ while (supertpt.tpe.symbol != null && supertpt.tpe.symbol.initialize.isTrait) {
mixins = typedType(supertpt) :: mixins
supertpt = TypeTree(supertpt.tpe.parents.head) setOriginal supertpt /* setPos supertpt.pos */
}
@@ -558,16 +558,16 @@ mixin class Typers requires Analyzer {
if (!psym.isClass)
error(parent.pos, "class type expected")
else if (psym != superclazz)
- if (psym.isMixin) {
+ if (psym.isTrait) {
val ps = psym.info.parents
if (!ps.isEmpty && !superclazz.isSubClass(ps.head.symbol))
error(parent.pos, "illegal inheritance; super"+superclazz+
"\n is not a subclass of the super"+ps.head.symbol+
"\n of the mixin " + psym);
} else if (settings.migrate.value)
- error(parent.pos, migrateMsg+psym+" needs to be a declared as a mixin class")
+ error(parent.pos, migrateMsg+psym+" needs to be a declared as a trait")
else
- error(parent.pos, ""+psym+" is not declared to be a mixin class")
+ error(parent.pos, ""+psym+" is not declared to be a trait")
else if (psym.hasFlag(FINAL))
error(parent.pos, "illegal inheritance from final class")
else if (!phase.erasedTypes && psym.isSealed &&
@@ -1295,7 +1295,6 @@ mixin class Typers requires Analyzer {
val rhs1 = typed(rhs, lhs1.tpe)
copy.Assign(tree, lhs1, rhs1) setType UnitClass.tpe
} else {
- System.out.println(""+lhs1+" "+varsym+" "+varsym.isValue+" "+flagsToString(varsym.flags));//debug
if (!lhs1.tpe.isError) error(tree.pos, "assignment to non-variable ")
setError(tree)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Variances.scala b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
index 2992f92d3c..2bdb019374 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Variances.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
@@ -9,7 +9,7 @@ import symtab.Flags._;
/** Variances form a lattice, 0 <= COVARIANT <= Variances, 0 <= CONTRAVARIANT <= VARIANCES
*/
-mixin class Variances {
+trait Variances {
val global: Global;
import global._;