diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreePrinters.scala | 12 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/Trees.scala | 2 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedAnyArray.scala | 8 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedArray.scala | 3 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedBooleanArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedByteArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedCharArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedDoubleArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedFloatArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedIntArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedLongArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedObjectArray.scala | 7 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedShortArray.scala | 7 | ||||
-rw-r--r-- | test/files/neg/scopes.check | 4 | ||||
-rw-r--r-- | test/files/neg/scopes.scala | 2 |
15 files changed, 80 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala index 89fc896003..2f932a2e84 100644 --- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala +++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala @@ -128,13 +128,11 @@ abstract class TreePrinters { printTypeParams(tparams) print(" extends "); printRow(impl.parents, " with ") - if (!impl.body.isEmpty) { - print(" {"); - if (self.name != nme.WILDCARD) { - print(" "); print(self.name); printOpt(": ", self.tpt); print(" => ") - } else if (!self.tpt.isEmpty) { - print(" _ : "); print(self); print(" => ") - } + print(" {"); + if (self.name != nme.WILDCARD) { + print(" "); print(self.name); printOpt(": ", self.tpt); print(" => ") + } else if (!self.tpt.isEmpty) { + print(" _ : "); print(self.tpt); print(" => ") } printColumn(impl.body, "", ";", "}") diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index ac9a1ab02c..a2085bb50b 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -298,7 +298,7 @@ trait Trees requires Global { def ValDef(sym: Symbol): ValDef = ValDef(sym, EmptyTree) - object emptyValDef extends ValDef(Modifiers(PRIVATE), nme.WILDCARD, TypeTree(), EmptyTree) + object emptyValDef extends ValDef(Modifiers(PRIVATE), nme.WILDCARD, TypeTree(NoType), EmptyTree) /** Method definition * diff --git a/src/library/scala/runtime/BoxedAnyArray.scala b/src/library/scala/runtime/BoxedAnyArray.scala index 5a1a6b99cc..d979e34523 100644 --- a/src/library/scala/runtime/BoxedAnyArray.scala +++ b/src/library/scala/runtime/BoxedAnyArray.scala @@ -252,4 +252,12 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { } result } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new BoxedAnyArray(len) + Array.copy(this, start, result, 0, len) + result + } + } diff --git a/src/library/scala/runtime/BoxedArray.scala b/src/library/scala/runtime/BoxedArray.scala index 3ba9433f8a..0036c8f4fe 100644 --- a/src/library/scala/runtime/BoxedArray.scala +++ b/src/library/scala/runtime/BoxedArray.scala @@ -72,9 +72,6 @@ abstract class BoxedArray extends Seq[Any] { // todo: eliminate def subArray(from: Int, end: Int): AnyRef - override def slice(from: Int, end: Int): Seq[Object] = - subArray(from, end).asInstanceOf[Seq[Object]] - final override def map[b](f: Any => b): Array[b] = { val len = length val result = new Array[b](len) diff --git a/src/library/scala/runtime/BoxedBooleanArray.scala b/src/library/scala/runtime/BoxedBooleanArray.scala index 1dbf6bb987..1c434db467 100644 --- a/src/library/scala/runtime/BoxedBooleanArray.scala +++ b/src/library/scala/runtime/BoxedBooleanArray.scala @@ -57,4 +57,11 @@ final class BoxedBooleanArray(val value: Array[Boolean]) extends BoxedArray { } new BoxedBooleanArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Boolean](len) + Array.copy(value, start, result, 0, len) + new BoxedBooleanArray(result) + } } diff --git a/src/library/scala/runtime/BoxedByteArray.scala b/src/library/scala/runtime/BoxedByteArray.scala index 62407d6974..8580acf2a4 100644 --- a/src/library/scala/runtime/BoxedByteArray.scala +++ b/src/library/scala/runtime/BoxedByteArray.scala @@ -57,4 +57,11 @@ final class BoxedByteArray(val value: Array[Byte]) extends BoxedArray { } new BoxedByteArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Byte](len) + Array.copy(value, start, result, 0, len) + new BoxedByteArray(result) + } } diff --git a/src/library/scala/runtime/BoxedCharArray.scala b/src/library/scala/runtime/BoxedCharArray.scala index 1f823853eb..7e93c71c30 100644 --- a/src/library/scala/runtime/BoxedCharArray.scala +++ b/src/library/scala/runtime/BoxedCharArray.scala @@ -58,4 +58,11 @@ final class BoxedCharArray(val value: Array[Char]) extends BoxedArray { } new BoxedCharArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Char](len) + Array.copy(value, start, result, 0, len) + new BoxedCharArray(result) + } } diff --git a/src/library/scala/runtime/BoxedDoubleArray.scala b/src/library/scala/runtime/BoxedDoubleArray.scala index eca804d76c..951828e1cd 100644 --- a/src/library/scala/runtime/BoxedDoubleArray.scala +++ b/src/library/scala/runtime/BoxedDoubleArray.scala @@ -57,4 +57,11 @@ final class BoxedDoubleArray(val value: Array[Double]) extends BoxedArray { } new BoxedDoubleArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Double](len) + Array.copy(value, start, result, 0, len) + new BoxedDoubleArray(result) + } } diff --git a/src/library/scala/runtime/BoxedFloatArray.scala b/src/library/scala/runtime/BoxedFloatArray.scala index 0505a2545d..9e22386370 100644 --- a/src/library/scala/runtime/BoxedFloatArray.scala +++ b/src/library/scala/runtime/BoxedFloatArray.scala @@ -57,4 +57,11 @@ final class BoxedFloatArray(val value: Array[Float]) extends BoxedArray { } new BoxedFloatArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Float](len) + Array.copy(value, start, result, 0, len) + new BoxedFloatArray(result) + } } diff --git a/src/library/scala/runtime/BoxedIntArray.scala b/src/library/scala/runtime/BoxedIntArray.scala index 2519075a3a..633504a98f 100644 --- a/src/library/scala/runtime/BoxedIntArray.scala +++ b/src/library/scala/runtime/BoxedIntArray.scala @@ -57,4 +57,11 @@ final class BoxedIntArray(val value: Array[Int]) extends BoxedArray { } new BoxedIntArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Int](len) + Array.copy(value, start, result, 0, len) + new BoxedIntArray(result) + } } diff --git a/src/library/scala/runtime/BoxedLongArray.scala b/src/library/scala/runtime/BoxedLongArray.scala index f82d1711e1..9d0b7175d5 100644 --- a/src/library/scala/runtime/BoxedLongArray.scala +++ b/src/library/scala/runtime/BoxedLongArray.scala @@ -57,4 +57,11 @@ final class BoxedLongArray(val value: Array[Long]) extends BoxedArray { } new BoxedLongArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Long](len) + Array.copy(value, start, result, 0, len) + new BoxedLongArray(result) + } } diff --git a/src/library/scala/runtime/BoxedObjectArray.scala b/src/library/scala/runtime/BoxedObjectArray.scala index c1596d0949..48b1da7e8a 100644 --- a/src/library/scala/runtime/BoxedObjectArray.scala +++ b/src/library/scala/runtime/BoxedObjectArray.scala @@ -62,4 +62,11 @@ final class BoxedObjectArray(val value: Array[AnyRef]) extends BoxedArray { } new BoxedObjectArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = create(len) + Array.copy(value, start, result, 0, len) + new BoxedObjectArray(result) + } } diff --git a/src/library/scala/runtime/BoxedShortArray.scala b/src/library/scala/runtime/BoxedShortArray.scala index c3bc7a6125..256bd43727 100644 --- a/src/library/scala/runtime/BoxedShortArray.scala +++ b/src/library/scala/runtime/BoxedShortArray.scala @@ -57,4 +57,11 @@ final class BoxedShortArray(val value: Array[Short]) extends BoxedArray { } new BoxedShortArray(result) } + + final override def slice(start: Int, end: Int): BoxedArray = { + val len = end - start + val result = new Array[Short](len) + Array.copy(value, start, result, 0, len) + new BoxedShortArray(result) + } } diff --git a/test/files/neg/scopes.check b/test/files/neg/scopes.check index 6e0a3c1081..b312893044 100644 --- a/test/files/neg/scopes.check +++ b/test/files/neg/scopes.check @@ -17,8 +17,8 @@ scopes.scala:14: error: y is already defined as value y def f2(x: int)(y: int, y: float) = x + y ^ scopes.scala:15: error: x is already defined as value x - (x: int, x: float) => x - ^ + val closure = (x: int, x: float) => x + ^ scopes.scala:17: error: x is already defined as value x case x::x => x ^ diff --git a/test/files/neg/scopes.scala b/test/files/neg/scopes.scala index 321ae223b8..e38a0a3d2e 100644 --- a/test/files/neg/scopes.scala +++ b/test/files/neg/scopes.scala @@ -12,7 +12,7 @@ object test1 { } def f1(x: int, x: float) = x def f2(x: int)(y: int, y: float) = x + y - (x: int, x: float) => x + val closure = (x: int, x: float) => x List() match { case x::x => x case Nil => Nil |