summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-04-24 18:40:12 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-04-24 18:54:21 +0200
commita47acbc36d312cc12ab02f4564edff1deb93d941 (patch)
treec433d551cb69e7d26f7f291e4659a45c4f569c08 /src/compiler
parent2890714d7bcdd55b7a62091dcdf031cc3efe0822 (diff)
downloadscala-a47acbc36d312cc12ab02f4564edff1deb93d941.tar.gz
scala-a47acbc36d312cc12ab02f4564edff1deb93d941.tar.bz2
scala-a47acbc36d312cc12ab02f4564edff1deb93d941.zip
copy BackQuotedIdent trees (don't copy as Ident)
typer synthesized the wrong isDefinedAt method in typedMatchAnon because a BackQuotedIdent was copied as an Ident, so that the equality check was performed in applyOrElse (since it operates on the original tree), but not in isDefinedAt (since it operates on the copy, which collapsed Ident and BackQuotedIdent)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/reflect/internal/TreePrinters.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
3 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/reflect/internal/TreePrinters.scala b/src/compiler/scala/reflect/internal/TreePrinters.scala
index 486a3d3567..3093bb049a 100644
--- a/src/compiler/scala/reflect/internal/TreePrinters.scala
+++ b/src/compiler/scala/reflect/internal/TreePrinters.scala
@@ -373,6 +373,9 @@ trait TreePrinters extends api.TreePrinters { self: SymbolTable =>
case Select(qualifier, name) =>
print(backquotedPath(qualifier), ".", symName(tree, name))
+ case bqid: BackQuotedIdent =>
+ print("`%s`" format symName(tree, bqid.name))
+
case Ident(name) =>
print(symName(tree, name))
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
index 3be8397a9c..96d92e0609 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
@@ -136,7 +136,7 @@ trait PatMatVirtualiser extends ast.TreeDSL { self: Analyzer =>
// (that would require more sophistication when generating trees,
// and the only place that emits Matches after typers is for exception handling anyway)
if(phase.id >= currentRun.uncurryPhase.id) debugwarn("running translateMatch at "+ phase +" on "+ scrut +" match "+ cases)
-
+ // println("translating "+ cases.mkString("{", "\n", "}"))
val scrutSym = freshSym(scrut.pos, pureType(scrutType)) setFlag SYNTH_CASE
// pt = Any* occurs when compiling test/files/pos/annotDepMethType.scala with -Xexperimental
combineCases(scrut, scrutSym, cases map translateCase(scrutSym, pt), pt, matchOwner, matchFailGenOverride)
@@ -987,6 +987,7 @@ class Foo(x: Other) { x._1 } // no error in this order
fixerUpper(owner, scrut.pos){
val ptDefined = if (isFullyDefined(pt)) pt else NoType
def matchFailGen = (matchFailGenOverride orElse Some(CODE.MATCHERROR(_: Tree)))
+ // println("combining cases: "+ (casesNoSubstOnly.map(_.mkString(" >> ")).mkString("{", "\n", "}")))
emitSwitch(scrut, scrutSym, casesNoSubstOnly, pt, matchFailGenOverride).getOrElse{
if (casesNoSubstOnly nonEmpty) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ba6a363095..1414424a0b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2288,6 +2288,7 @@ trait Typers extends Modes with Adaptations with Taggings with PatMatVirtualiser
// need to duplicate the cases before typing them to generate the apply method, or the symbols will be all messed up
val casesTrue = if (isPartial) cases map (c => deriveCaseDef(c)(x => TRUE_typed).duplicate) else Nil
+ // println("casesTrue "+ casesTrue)
def parentsPartial(targs: List[Type]) = List(appliedType(AbstractPartialFunctionClass.typeConstructor, targs), SerializableClass.tpe)
def applyMethod = {
@@ -2373,6 +2374,7 @@ trait Typers extends Modes with Adaptations with Taggings with PatMatVirtualiser
}
val members = if (isPartial) {
+ // TODO: don't check for MarkerCPSTypes -- check whether all targs are subtype of any (which they are not under CPS)
if ((MarkerCPSTypes ne NoSymbol) && (targs exists (_ hasAnnotation MarkerCPSTypes))) List(applyMethod, isDefinedAtMethod)
else List(applyOrElseMethodDef, isDefinedAtMethod)
} else List(applyMethod)