diff options
6 files changed, 19 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Flags.scala b/src/compiler/scala/tools/nsc/symtab/Flags.scala index 39563cab29..cc4d1f38f1 100644 --- a/src/compiler/scala/tools/nsc/symtab/Flags.scala +++ b/src/compiler/scala/tools/nsc/symtab/Flags.scala @@ -31,7 +31,12 @@ object Flags { final val DEPRECATED = 0x00008000; // symbol is deprecated. final val COVARIANT = 0x00010000; // symbol is a covariant type variable + final val CAPTURED = 0x00010000; // variable is accessed from nested function. Set by LambdaLift + final val BYNAMEPARAM = 0x00010000; // parameter is by name final val CONTRAVARIANT = 0x00020000; // symbol is a contravariant type variable + final val LABEL = 0x00020000; // method symbol is a label. Set by TailCall + final val INCONSTRUCTOR = 0x00020000; // class symbol is defined in this/superclass constructor. + final val ABSOVERRIDE = 0x00040000; // combination of abstract & override final val LOCAL = 0x00080000; // symbol is local to current class. // pre: PRIVATE is also set @@ -51,12 +56,6 @@ object Flags { final val PARAMACCESSOR = 0x20000000; // for value definitions: is an access method for a final val parameter // for parameters: is a val parameter - final val CAPTURED = 0x40000000; // variable is accessed from nested function. Set by LambdaLift - final val BYNAMEPARAM = 0x40000000; // parameter is by name - - final val LABEL = 0x80000000L; // method symbol is a label. Set by TailCall - final val INCONSTRUCTOR = 0x80000000L; // class symbol is defined in this/superclass constructor. - final val IS_ERROR = 0x100000000L; // symbol is an error symbol final val OVERLOADED = 0x200000000L; // symbol is overloaded final val LIFTED = 0x400000000L; // class has been lifted out to package level diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index d93298d5c6..cb487da083 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -262,10 +262,14 @@ mixin class Symbols requires SymbolTable { final def isInitialized: boolean = validForRun == currentRun; + final def isCovariant: boolean = isType && hasFlag(COVARIANT); + + final def isContravariant: boolean = isType && hasFlag(CONTRAVARIANT); + /** The variance of this symbol as an integer */ final def variance: int = - if (hasFlag(COVARIANT)) 1 - else if (hasFlag(CONTRAVARIANT)) -1 + if (isCovariant) 1 + else if (isContravariant) -1 else 0; // Flags, owner, and name attributes -------------------------------------------------------------- diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 7fda6f09ed..67b6708f19 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1514,8 +1514,8 @@ mixin class Types requires SymbolTable { tps1.isEmpty && tps2.isEmpty || !tps1.isEmpty && !tps2.isEmpty && - (tparams.head.hasFlag(COVARIANT) || (tps2.head <:< tps1.head)) && - (tparams.head.hasFlag(CONTRAVARIANT) || tps1.head <:< tps2.head) && + (tparams.head.isCovariant || (tps2.head <:< tps1.head)) && + (tparams.head.isContravariant || (tps1.head <:< tps2.head)) && isSubArgs(tps1.tail, tps2.tail, tparams.tail) ); (sym1 == sym2 && (pre1 <:< pre2) && isSubArgs(args1, args2, sym1.typeParams) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/PickleFormat.scala b/src/compiler/scala/tools/nsc/symtab/classfile/PickleFormat.scala index 7709a5ba5d..9769492be2 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/PickleFormat.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/PickleFormat.scala @@ -53,8 +53,8 @@ object PickleFormat { * * len is remaining length after `len'. */ - val MajorVersion = 2; - val MinorVersion = 1; + val MajorVersion = 3; + val MinorVersion = 0; final val TERMname = 1; final val TYPEname = 2; diff --git a/src/compiler/scala/tools/nsc/typechecker/Variances.scala b/src/compiler/scala/tools/nsc/typechecker/Variances.scala index 100230d70f..2992f92d3c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Variances.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Variances.scala @@ -55,8 +55,8 @@ mixin class Variances { var v: int = VARIANCES; for (val Pair(tp, tparam1) <- tps zip tparams1) { val v1 = varianceInType(tp)(tparam); - v = v & (if (tparam1.hasFlag(COVARIANT)) v1 - else if (tparam1.hasFlag(CONTRAVARIANT)) flip(v1) + v = v & (if (tparam1.isCovariant) v1 + else if (tparam1.isContravariant) flip(v1) else cut(v1)) } v diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index a676615ceb..41c59a351d 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id: $ +// $Id$ package scala.tools.nsc.util; @@ -75,6 +75,7 @@ object ClassPath { val ret = find0(entries); if (false && this.toString().indexOf("scala") != -1) System.err.println("FIND " + name + " in " + this + " => " + ret); + assert(!ret.entries.isEmpty, ""+this+" "+name); ret; } else null; |