diff options
author | David MacIver <david.maciver@gmail.com> | 2009-02-28 22:35:36 +0000 |
---|---|---|
committer | David MacIver <david.maciver@gmail.com> | 2009-02-28 22:35:36 +0000 |
commit | 9fc30e17b2b6550850933b499a211bb7532ff51b (patch) | |
tree | e86aee4f3cd22bcee8ae16a508b214b3c949d933 | |
parent | 305fe3a352099315df2cd409e918b712485af15d (diff) | |
download | scala-9fc30e17b2b6550850933b499a211bb7532ff51b.tar.gz scala-9fc30e17b2b6550850933b499a211bb7532ff51b.tar.bz2 scala-9fc30e17b2b6550850933b499a211bb7532ff51b.zip |
Fix for ticket #1718
-rw-r--r-- | src/compiler/scala/tools/ant/Scalac.scala | 9 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/CodeFactory.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Erasure.scala | 5 | ||||
-rw-r--r-- | src/library/scala/runtime/ScalaRunTime.scala | 1 | ||||
-rw-r--r-- | test/files/run/t1718.check | 1 | ||||
-rw-r--r-- | test/files/run/t1718.scala | 10 |
6 files changed, 20 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index 55e2fcfc09..920d7b2c66 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -490,10 +490,6 @@ class Scalac extends MatchingTask { val includedFiles = getDirectoryScanner(originDir).getIncludedFiles() var scalaFiles = includedFiles.filter(_.endsWith(".scala")) val javaFiles = includedFiles.filter(_.endsWith(".java")) - if (!force) { - scalaFiles = new SourceFileScanner(this). - restrict(scalaFiles, originDir, destination.get, mapper) - } javaOnly = javaOnly && (scalaFiles.length == 0) val list = scalaFiles.toList ::: javaFiles.toList if (scalacDebugging && list.length > 0) @@ -556,6 +552,11 @@ class Scalac extends MatchingTask { log("Scalac params = '" + addParams + "'", Project.MSG_DEBUG) settings.parseParams(addParams, error) + + if(force){ + settings.make.value = "all" + } + (settings, sourceFiles, javaOnly) } diff --git a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala index 2dc20532ab..769e739adf 100644 --- a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala +++ b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala @@ -96,8 +96,8 @@ trait CodeFactory { final def Equals (left: Tree, right: Tree): Tree = fn(left, nme.EQ, right) final def Eq (left: Tree, right: Tree): Tree = fn(left, nme.eq, right) final def GTE (left: Tree, right: Tree): Tree = fn(left, nme.GE, right) // >= - final def And (left: Tree, right: Tree): Tree = fn(left, AND, right) - final def Not (arg: Tree): Tree = Select(arg, NOT) + final def And (terms: Tree*): Tree = terms.reduceLeft((left, right) => fn(left, AND, right)) + final def Not (arg: Tree): Tree = Select(arg, NOT) final def ThrowMatchError(pos: Position, obj: Tree) = atPos(pos) { Throw( New(TypeTree(MatchErrorClass.tpe), List(List(obj))) ) diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index e520778398..3072d2d465 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -362,10 +362,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { if (treeInfo.isPureExpr(tree)) gen.mkAttributedRef(BoxedUnit_UNIT) else Block(List(tree), gen.mkAttributedRef(BoxedUnit_UNIT)) } else if (sym == ArrayClass) { - val elemClass = tree.tpe.typeArgs.head.typeSymbol; - val boxedClass = if (isValueClass(elemClass)) boxedArrayClass(elemClass) - else BoxedObjectArrayClass; - Apply(Select(New(TypeTree(boxedClass.tpe)), nme.CONSTRUCTOR), List(tree)) + boxArray(tree) } else { Apply(gen.mkAttributedRef(boxMethod(tree.tpe.typeSymbol)), List(tree)). setPos(tree.pos) setType ObjectClass.tpe diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index ea5e51f0ce..84f1945177 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -144,6 +144,7 @@ object ScalaRunTime { case x: Array[Boolean] => new BoxedBooleanArray(x) case x: Array[AnyRef] => new BoxedObjectArray(x) case x: BoxedArray[_] => x + case null => null } /** Given any Scala value, convert it to a String. diff --git a/test/files/run/t1718.check b/test/files/run/t1718.check new file mode 100644 index 0000000000..27ba77ddaf --- /dev/null +++ b/test/files/run/t1718.check @@ -0,0 +1 @@ +true diff --git a/test/files/run/t1718.scala b/test/files/run/t1718.scala new file mode 100644 index 0000000000..61a17b2906 --- /dev/null +++ b/test/files/run/t1718.scala @@ -0,0 +1,10 @@ +object Test extends Application{ + def matchesNull[T](mightBeNull: Array[T]): Boolean = mightBeNull match { + case null => true + case x => false + } + + val nullArray: Array[String] = null + println(matchesNull(nullArray)) +} + |