summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-03-27 12:15:09 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-03-27 13:54:37 +0200
commit65340ed4ad2ee9c9befb60e3e69023930dcb280c (patch)
treea4ca30dd6c163fe6f1b716316486da77e9cc33ed /src
parent418053b960a36ebd503d84bafdaf90e1e525588f (diff)
downloadscala-65340ed4ad2ee9c9befb60e3e69023930dcb280c.tar.gz
scala-65340ed4ad2ee9c9befb60e3e69023930dcb280c.tar.bz2
scala-65340ed4ad2ee9c9befb60e3e69023930dcb280c.zip
[vpm] suppress refchecks in matches
didn't realize this was done for the old pattern matcher, so now we have "feature"-parity we still infer bad type arguments for type patterns -- see e.g., pos/t602.scala -- also, inference changes when you turn a case class into the corresponding class&companion object, with the same unapply as the synthetic one TODO: can we merge inferConstructorInstance & inferTypedPattern, or at least make them behave consistently?
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index d98d248231..013a74da7e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1625,12 +1625,18 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R
case _ => tree
}
+ // skip refchecks in patterns....
result = result match {
case CaseDef(pat, guard, body) =>
inPattern = true
val pat1 = transform(pat)
inPattern = false
treeCopy.CaseDef(tree, pat1, transform(guard), transform(body))
+ case LabelDef(_, _, _) if gen.hasSynthCaseSymbol(result) =>
+ inPattern = true
+ val res = deriveLabelDef(result)(transform)
+ inPattern = false
+ res
case _ =>
super.transform(result)
}