summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid MacIver <david.maciver@gmail.com>2008-11-10 00:29:09 +0000
committerDavid MacIver <david.maciver@gmail.com>2008-11-10 00:29:09 +0000
commit5d6c2cb4c663f4351f5eacb6c9f6f9b0cedf4966 (patch)
tree797cc6fc9ba4caa5f2ae0fc1823c7b58d0ea6018
parentfff82dd82874892d0e00f6d0986be8951180f7f6 (diff)
downloadscala-5d6c2cb4c663f4351f5eacb6c9f6f9b0cedf4966.tar.gz
scala-5d6c2cb4c663f4351f5eacb6c9f6f9b0cedf4966.tar.bz2
scala-5d6c2cb4c663f4351f5eacb6c9f6f9b0cedf4966.zip
Reversion of the changes to targetParams which ...
Reversion of the changes to targetParams which I made to fix #1260 as they caused problems (specifically #1480). This code is wrong but it's the old wrong behaviour, which is less broken than the new wrong behaviour.
-rw-r--r--src/compiler/scala/tools/nsc/matching/CodeFactory.scala14
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternNodes.scala4
-rw-r--r--test/files/pos/t1480.scala (renamed from test/pending/pos/t1480.scala)0
-rw-r--r--test/pending/pos/t1260.scala (renamed from test/files/pos/t1260.scala)0
-rw-r--r--test/pending/run/complicatedmatch.check (renamed from test/files/run/complicatedmatch.check)0
-rw-r--r--test/pending/run/complicatedmatch.scala (renamed from test/files/run/complicatedmatch.scala)0
6 files changed, 7 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
index 24b4a908c8..13fc7f830c 100644
--- a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
+++ b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
@@ -97,17 +97,11 @@ trait CodeFactory {
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 Not(arg: Tree) = arg match {
- case TRUE => FALSE
- case FALSE => TRUE
- case t => Select(arg, NOT)
- }
+ final def Not(arg: Tree) =
+ Select(arg, NOT)
- final def And(left: Tree, right: Tree): Tree = (left, right) match {
- case (Const(value: Boolean), _) => if (value) right else left
- case (_, TRUE) => left
- case _ => fn(left, AND, right)
- }
+ final def And(left: Tree, right: Tree): Tree =
+ fn(left, AND, right)
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/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
index 57ff8faeaf..43b8af7da8 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
@@ -133,7 +133,9 @@ trait PatternNodes { self: transform.ExplicitOuter =>
* The corresponding list of value definitions.
*/
final def targetParams(implicit typer: Typer): List[ValDef] =
- bindings.toList.map{ case Binding(v, t) => ValDef(v, typer.typed(mkIdent(t))) }
+ bindings.toList.map{ case Binding(v, t) => ValDef(v,
+ typer.typed{if(t.tpe <:< v.tpe) mkIdent(t)
+ else gen.mkAsInstanceOf(mkIdent(t), v.tpe)})}
}
val NoBinding: Bindings = Bindings()
diff --git a/test/pending/pos/t1480.scala b/test/files/pos/t1480.scala
index 1d9f94d2e9..1d9f94d2e9 100644
--- a/test/pending/pos/t1480.scala
+++ b/test/files/pos/t1480.scala
diff --git a/test/files/pos/t1260.scala b/test/pending/pos/t1260.scala
index b05259998e..b05259998e 100644
--- a/test/files/pos/t1260.scala
+++ b/test/pending/pos/t1260.scala
diff --git a/test/files/run/complicatedmatch.check b/test/pending/run/complicatedmatch.check
index 501b7a32d6..501b7a32d6 100644
--- a/test/files/run/complicatedmatch.check
+++ b/test/pending/run/complicatedmatch.check
diff --git a/test/files/run/complicatedmatch.scala b/test/pending/run/complicatedmatch.scala
index c837c328b3..c837c328b3 100644
--- a/test/files/run/complicatedmatch.scala
+++ b/test/pending/run/complicatedmatch.scala