summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala10
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Checkers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala18
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala14
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala2
8 files changed, 29 insertions, 27 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 0604f8e59f..f65cb3b05b 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -329,7 +329,7 @@ abstract class TreeBuilder {
/** Create tree for a lifted expression XX-LIFTING
*/
def makeLifted(gs: List[ValFrom], body: Tree): Tree = {
- def combine(gs: List[ValFrom]): ValFrom = (gs: @unsealed) match {
+ def combine(gs: List[ValFrom]): ValFrom = (gs: @unchecked) match {
case g :: Nil => g
case ValFrom(pos1, pat1, rhs1) :: gs2 =>
val ValFrom(pos2, pat2, rhs2) = combine(gs2)
@@ -368,13 +368,13 @@ abstract class TreeBuilder {
def makeVisitor(cases: List[CaseDef], checkExhaustive: boolean): Tree =
makeVisitor(cases, checkExhaustive, "x$")
- private def makeUnsealed(expr: Tree): Tree =
- Annotated(Annotation(New(scalaDot(definitions.UnsealedClass.name), List(List())), List()), expr)
+ private def makeUnchecked(expr: Tree): Tree =
+ Annotated(Annotation(New(scalaDot(definitions.UncheckedClass.name), List(List())), List()), expr)
/** Create visitor <x => x match cases> */
def makeVisitor(cases: List[CaseDef], checkExhaustive: boolean, prefix: String): Tree = {
val x = freshName(prefix)
- val sel = if (checkExhaustive) Ident(x) else makeUnsealed(Ident(x))
+ val sel = if (checkExhaustive) Ident(x) else makeUnchecked(Ident(x))
Function(List(makeSyntheticParam(x)), Match(sel, cases))
}
@@ -407,7 +407,7 @@ abstract class TreeBuilder {
val vars = getVariables(pat1)
val matchExpr = atPos(pat1.pos){
Match(
- makeUnsealed(rhs),
+ makeUnchecked(rhs),
List(CaseDef(pat1, EmptyTree, makeTupleTerm(vars map (._1) map Ident, true))))
}
vars match {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
index 97189b602f..e1daa00c13 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
@@ -268,7 +268,7 @@ abstract class Checkers {
case LOAD_ARRAY_ITEM(kind) =>
checkStack(2)
- (stack.pop2: @unsealed) match {
+ (stack.pop2: @unchecked) match {
case (INT, ARRAY(elem)) =>
if (!(elem <:< kind))
typeError(kind, elem);
@@ -301,7 +301,7 @@ abstract class Checkers {
case STORE_ARRAY_ITEM(kind) =>
checkStack(3);
- (stack.pop3: @unsealed) match {
+ (stack.pop3: @unchecked) match {
case (k, INT, ARRAY(elem)) =>
if (!(k <:< kind))
typeError(kind, k);
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index f18c958b5e..939238062c 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -819,7 +819,7 @@ abstract class GenJVM extends SubComponent {
jcode.emitDUP()
jcode.emitIFNONNULL(nonNull)
jcode.emitPOP()
- (boxKind: @unsealed) match {
+ (boxKind: @unchecked) match {
case BYTE => jcode.emitPUSH(0: Byte)
case SHORT => jcode.emitPUSH(0: Short)
case CHAR => jcode.emitPUSH(0: Char)
@@ -911,7 +911,7 @@ abstract class GenJVM extends SubComponent {
}
case _ =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case LONG => jcode.emitLCMP()
case FLOAT => jcode.emitFCMPG()
case DOUBLE => jcode.emitDCMPG()
@@ -947,7 +947,7 @@ abstract class GenJVM extends SubComponent {
}
case _ =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case LONG => jcode.emitLCONST_0(); jcode.emitLCMP()
case FLOAT => jcode.emitFCONST_0(); jcode.emitFCMPL()
case DOUBLE => jcode.emitDCONST_0(); jcode.emitDCMPL()
@@ -1052,7 +1052,7 @@ abstract class GenJVM extends SubComponent {
op match {
case ADD => jcode.emitADD(javaType(kind))
case SUB =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case BOOL | BYTE | CHAR | SHORT | INT =>
jcode.emitISUB()
case LONG => jcode.emitLSUB()
@@ -1061,7 +1061,7 @@ abstract class GenJVM extends SubComponent {
}
case MUL =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case BOOL | BYTE | CHAR | SHORT | INT =>
jcode.emitIMUL()
case LONG => jcode.emitLMUL()
@@ -1070,7 +1070,7 @@ abstract class GenJVM extends SubComponent {
}
case DIV =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case BOOL | BYTE | CHAR | SHORT | INT =>
jcode.emitIDIV()
case LONG => jcode.emitLDIV()
@@ -1079,7 +1079,7 @@ abstract class GenJVM extends SubComponent {
}
case REM =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case BOOL | BYTE | CHAR | SHORT | INT =>
jcode.emitIREM()
case LONG => jcode.emitLREM()
@@ -1158,7 +1158,7 @@ abstract class GenJVM extends SubComponent {
jcode.emitT2T(javaType(INT), javaType(kind))
}
- case Comparison(op, kind) => ((op, kind): @unsealed) match {
+ case Comparison(op, kind) => ((op, kind): @unchecked) match {
case (CMP, LONG) => jcode.emitLCMP()
case (CMPL, FLOAT) => jcode.emitFCMPL()
case (CMPG, FLOAT) => jcode.emitFCMPG()
@@ -1377,7 +1377,7 @@ abstract class GenJVM extends SubComponent {
sym.isNonBottomSubClass(definitions.ClassfileAnnotationClass))
- def javaType(t: TypeKind): JType = (t: @unsealed) match {
+ def javaType(t: TypeKind): JType = (t: @unchecked) match {
case UNIT => JType.VOID
case BOOL => JType.BOOLEAN
case BYTE => JType.BYTE
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 1a21da8c98..98f0f4bdf4 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -1213,7 +1213,7 @@ abstract class GenMSIL extends SubComponent {
}
case LOAD_ARRAY_ITEM(kind) =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case BOOL => mcode.Emit(OpCodes.Ldelem_I1)
case BYTE => mcode.Emit(OpCodes.Ldelem_U1)
case SHORT => mcode.Emit(OpCodes.Ldelem_I2)
@@ -1264,7 +1264,7 @@ abstract class GenMSIL extends SubComponent {
mcode.Emit(OpCodes.Ldsfld, getModuleInstanceField(module))
case STORE_ARRAY_ITEM(kind) =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case BOOL => mcode.Emit(OpCodes.Stelem_I1)
case BYTE => mcode.Emit(OpCodes.Stelem_I1)
case SHORT => mcode.Emit(OpCodes.Stelem_I2)
@@ -1323,7 +1323,7 @@ abstract class GenMSIL extends SubComponent {
case CALL_METHOD(msym, style) =>
if (msym.isClassConstructor) {
val constructorInfo: ConstructorInfo = getConstructor(msym)
- (style: @unsealed) match {
+ (style: @unchecked) match {
// normal constructor calls are Static..
case Static(_) =>
if (method.symbol.isClassConstructor && method.symbol.owner == msym.owner)
@@ -1514,7 +1514,7 @@ abstract class GenMSIL extends SubComponent {
}
case CZJUMP(success, failure, cond, kind) =>
- (kind: @unsealed) match {
+ (kind: @unchecked) match {
case BOOL | REFERENCE(_) =>
if (nextBlock == success || omitJumpBlocks.contains(currentBlock)) {
emitBrBool(cond.negate, labels(failure))
@@ -1913,7 +1913,7 @@ abstract class GenMSIL extends SubComponent {
// #####################################################################
// get and create types
- private def msilType(t: TypeKind): MsilType = (t: @unsealed) match {
+ private def msilType(t: TypeKind): MsilType = (t: @unchecked) match {
case UNIT => MVOID
case BOOL => MBOOL
case BYTE => MBYTE
@@ -2238,7 +2238,7 @@ abstract class GenMSIL extends SubComponent {
} //def createDelegateCaller
- def emitBox(code: ILGenerator, boxType: TypeKind) = (boxType: @unsealed) match {
+ def emitBox(code: ILGenerator, boxType: TypeKind) = (boxType: @unchecked) match {
// doesn't make sense, unit as parameter..
case UNIT => code.Emit(OpCodes.Ldsfld, boxedUnit)
case BOOL | BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE =>
@@ -2248,7 +2248,7 @@ abstract class GenMSIL extends SubComponent {
case REFERENCE(_) | ARRAY(_) => ()
}
- def emitUnbox(code: ILGenerator, boxType: TypeKind) = (boxType: @unsealed) match {
+ def emitUnbox(code: ILGenerator, boxType: TypeKind) = (boxType: @unchecked) match {
case UNIT => code.Emit(OpCodes.Pop)
case BOOL => code.Emit(OpCodes.Unbox, MBOOL); code.Emit(OpCodes.Ldind_I1)
case BYTE => code.Emit(OpCodes.Call, toByte)
diff --git a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
index cf43b4f611..9bdd2f64e9 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
@@ -154,7 +154,7 @@ abstract class ClosureElimination extends SubComponent {
}
/* Partial mapping from values to instructions that load them. */
- def valueToInstruction(v: Value): Instruction = (v: @unsealed) match {
+ def valueToInstruction(v: Value): Instruction = (v: @unchecked) match {
case Deref(LocalVar(v)) =>
LOAD_LOCAL(v)
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 4f52dc2598..c8bea1c5fc 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -107,6 +107,7 @@ trait Definitions requires SymbolTable {
var RepeatedParamClass: Symbol = _
var ByNameParamClass: Symbol = _
var UnsealedClass: Symbol = _
+ var UncheckedClass: Symbol = _
val MaxTupleArity = 22
val TupleClass: Array[Symbol] = new Array(MaxTupleArity + 1)
@@ -803,7 +804,8 @@ trait Definitions requires SymbolTable {
ByNameParamClass = newCovariantPolyClass(
ScalaPackageClass, nme.BYNAME_PARAM_CLASS_NAME, tparam => AnyClass.typeConstructor)
/* <unapply> */
- UnsealedClass = getClass("scala.unsealed")
+ UnsealedClass = getClass("scala.unsealed") //todo: remove once 2.4 is out.
+ UncheckedClass = getClass("scala.unchecked")
OptionClass = getClass("scala.Option")
for (val i <- 1 to MaxTupleArity) {
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 9c096e4df7..b1235c9c94 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -288,7 +288,7 @@ abstract class AddInterfaces extends InfoTransform {
mc.hasFlag(lateINTERFACE) && mc != ScalaObjectClass)
yield mixinConstructorCall(implClass(mc))
}
- (tree: @unsealed) match {
+ (tree: @unchecked) match {
case Block(supercall :: stats, expr) =>
copy.Block(tree, supercall :: mixinConstructorCalls ::: stats, expr)
}
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 15197b413e..b07228c305 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -494,7 +494,7 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter
var checkExhaustive = true
def isUnsealedAnnotation(tpe: Type) = tpe match {
- case AnnotatedType(List(AnnotationInfo(atp, _, _)), _) if atp.symbol == UnsealedClass =>
+ case AnnotatedType(List(AnnotationInfo(atp, _, _)), _) if atp.symbol == UncheckedClass =>
true
case _ =>
false