summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-05-16 10:55:19 +0000
committerMartin Odersky <odersky@gmail.com>2006-05-16 10:55:19 +0000
commitbc46a1b53603f1ecfa9061466c36909c51a19a55 (patch)
treeedaa5496f8f85dd1203784f284c231547a7ff410
parent703ba993c311aa8d452608fc94414e2778218fd6 (diff)
downloadscala-bc46a1b53603f1ecfa9061466c36909c51a19a55.tar.gz
scala-bc46a1b53603f1ecfa9061466c36909c51a19a55.tar.bz2
scala-bc46a1b53603f1ecfa9061466c36909c51a19a55.zip
Fixed bug 593
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala3
-rw-r--r--src/library/scala/runtime/BoxedObjectArray.scala2
-rw-r--r--test/files/neg/bug593.check4
-rw-r--r--test/files/neg/bug593.scala2
-rw-r--r--test/files/run/bug594.check2
-rw-r--r--test/files/run/bug594.scala8
6 files changed, 19 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 0ecfeb9b3e..f63ebed3a4 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1621,7 +1621,8 @@ trait Parsers requires SyntaxAnalyzer {
val implicitViews = new ListBuffer[Tree];
val tparams = typeParamClauseOpt(name, implicitViews);
//if (mods.hasFlag(Flags.CASE) && in.token != LPAREN) accept(LPAREN);
- val vparamss = paramClauses(name, implicitViews.toList, mods.hasFlag(Flags.CASE));
+ val vparamss = if (mods.hasFlag(Flags.TRAIT)) List()
+ else paramClauses(name, implicitViews.toList, mods.hasFlag(Flags.CASE));
val thistpe = requiresTypeOpt();
val template = classTemplate(mods, name, vparamss);
val mods1 = if (mods.hasFlag(Flags.TRAIT) && (template.body forall treeInfo.isInterfaceMember))
diff --git a/src/library/scala/runtime/BoxedObjectArray.scala b/src/library/scala/runtime/BoxedObjectArray.scala
index 6563e12e4b..98a4cbc060 100644
--- a/src/library/scala/runtime/BoxedObjectArray.scala
+++ b/src/library/scala/runtime/BoxedObjectArray.scala
@@ -31,7 +31,7 @@ final class BoxedObjectArray(val value: Array[Object]) extends BoxedArray {
override def hashCode(): Int = value.hashCode();
- private def create(length: int): Array[Object] = {
+ private def create(length: Int): Array[Object] = {
val elemClass = value.getClass().getComponentType()
java.lang.reflect.Array.newInstance(elemClass, length).asInstanceOf[Array[Object]]
}
diff --git a/test/files/neg/bug593.check b/test/files/neg/bug593.check
new file mode 100644
index 0000000000..c29e68da7a
--- /dev/null
+++ b/test/files/neg/bug593.check
@@ -0,0 +1,4 @@
+bug593.scala:1 error: `extends' or `{' expected
+trait Wrapper[T](x : T) {
+ ^
+one error found
diff --git a/test/files/neg/bug593.scala b/test/files/neg/bug593.scala
new file mode 100644
index 0000000000..df7199a42a
--- /dev/null
+++ b/test/files/neg/bug593.scala
@@ -0,0 +1,2 @@
+trait Wrapper[T](x : T) {
+}
diff --git a/test/files/run/bug594.check b/test/files/run/bug594.check
new file mode 100644
index 0000000000..814f4a4229
--- /dev/null
+++ b/test/files/run/bug594.check
@@ -0,0 +1,2 @@
+one
+two
diff --git a/test/files/run/bug594.scala b/test/files/run/bug594.scala
new file mode 100644
index 0000000000..b120f47338
--- /dev/null
+++ b/test/files/run/bug594.scala
@@ -0,0 +1,8 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ val array = Array("one", "two", "three")
+ val firstTwo: Array[String] = array.subArray(0,2)
+ for(val x <- firstTwo)
+ Console.println(x)
+ }
+}