diff options
author | David MacIver <david.maciver@gmail.com> | 2008-11-10 00:29:09 +0000 |
---|---|---|
committer | David MacIver <david.maciver@gmail.com> | 2008-11-10 00:29:09 +0000 |
commit | 5d6c2cb4c663f4351f5eacb6c9f6f9b0cedf4966 (patch) | |
tree | 797cc6fc9ba4caa5f2ae0fc1823c7b58d0ea6018 /src | |
parent | fff82dd82874892d0e00f6d0986be8951180f7f6 (diff) | |
download | scala-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.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/CodeFactory.scala | 14 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/PatternNodes.scala | 4 |
2 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() |