summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid MacIver <david.maciver@gmail.com>2008-10-26 10:21:47 +0000
committerDavid MacIver <david.maciver@gmail.com>2008-10-26 10:21:47 +0000
commitf902a988a09721e1c894f42544d25a51fe2801d1 (patch)
tree51be8438ffe55190559c609575e0f2f3928b0bd2 /src
parent758092d16b71e7b0ddf552c54ae1a76a06834cb6 (diff)
downloadscala-f902a988a09721e1c894f42544d25a51fe2801d1.tar.gz
scala-f902a988a09721e1c894f42544d25a51fe2801d1.tar.bz2
scala-f902a988a09721e1c894f42544d25a51fe2801d1.zip
Fix for ticket 1260.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/matching/CodeFactory.scala16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
index 893506b742..8e034b1570 100644
--- a/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
+++ b/src/compiler/scala/tools/nsc/matching/CodeFactory.scala
@@ -37,16 +37,12 @@ trait CodeFactory {
final def targetLabel(owner: Symbol, pos: Position, name:String, argtpes:List[Type], resultTpe: Type) =
owner.newLabel(pos, name).setInfo(new MethodType(argtpes, resultTpe))
- final def targetParams(subst:Binding):List[ValDef] = if(subst eq NoBinding) Nil else subst match {
- case Binding(v,t,n) => ValDef(v, {
- //v.setFlag(symtab.Flags.TRANS_FLAG);
- if(t.tpe <:< v.tpe) mkIdent(t)
- else if(v.tpe <:< t.tpe) typed{gen.mkAsInstanceOf(mkIdent(t),v.tpe)} // refinement
- else {
- cunit.error(v.pos, "internal error, types don't match: pattern variable "+v+":"+v.tpe+" temp "+t+":"+t.tpe)
- typed{gen.mkAsInstanceOf(mkIdent(t), v.tpe)} // refinement
- }
- })::targetParams(n)
+ /**
+ * Convert a pattern binding into a list of value definitions.
+ */
+ final def targetParams(subst:Binding):List[ValDef] = subst match {
+ case NoBinding => Nil;
+ case Binding(v,t,n) => ValDef(v, typed(mkIdent(t)))::targetParams(n)
}
/** returns `List[ Tuple2[ scala.Int, <elemType> ] ]' */