summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid MacIver <david.maciver@gmail.com>2008-09-04 13:54:09 +0000
committerDavid MacIver <david.maciver@gmail.com>2008-09-04 13:54:09 +0000
commit350f4abecd78ba9ed9aca86022deb8a9992586a5 (patch)
tree3de3d8b952330956a7f95824980956c6ea2d20f3
parent329de99b63e0c69403c9c6e3084493c58c430a8e (diff)
downloadscala-350f4abecd78ba9ed9aca86022deb8a9992586a5.tar.gz
scala-350f4abecd78ba9ed9aca86022deb8a9992586a5.tar.bz2
scala-350f4abecd78ba9ed9aca86022deb8a9992586a5.zip
Fixed RefChecks to not replace unapplies with c...
Fixed RefChecks to not replace unapplies with constructors (ticket 0508). Moved test for this from pending to main tests.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala8
-rwxr-xr-xtest/files/run/t0508.scala (renamed from test/pending/run/t0508.scala)0
2 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 30a1fdc202..860e83666e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -774,6 +774,8 @@ abstract class RefChecks extends InfoTransform {
false
}
+ def isCaseApply(sym : Symbol) = sym.isSourceMethod && sym.hasFlag(CASE) && sym.name == nme.apply
+
val savedLocalTyper = localTyper
val savedCurrentApplication = currentApplication
val sym = tree.symbol
@@ -810,7 +812,7 @@ abstract class RefChecks extends InfoTransform {
}
case TypeApply(fn, args) =>
checkBounds(NoPrefix, NoSymbol, fn.tpe.typeParams, args map (_.tpe))
- if (sym.isSourceMethod && sym.hasFlag(CASE)) result = toConstructor(tree.pos, tree.tpe)
+ if (isCaseApply(sym)) result = toConstructor(tree.pos, tree.tpe)
case Apply(
Select(qual, nme.filter),
@@ -842,7 +844,7 @@ abstract class RefChecks extends InfoTransform {
"(such annotations are only allowed in arguments to *-parameters)")
case Ident(name) =>
- if (sym.isSourceMethod && sym.hasFlag(CASE))
+ if (isCaseApply(sym))
result = toConstructor(tree.pos, tree.tpe)
else if (name != nme.WILDCARD && name != nme.WILDCARD_STAR.toTypeName) {
assert(sym != NoSymbol, tree)//debug
@@ -860,7 +862,7 @@ abstract class RefChecks extends InfoTransform {
}
if (!hidden) escapedPrivateLocals += sym
}
- if (sym.isSourceMethod && sym.hasFlag(CASE))
+ if (isCaseApply(sym))
result = toConstructor(tree.pos, tree.tpe)
else qual match {
case Super(qualifier, mix) =>
diff --git a/test/pending/run/t0508.scala b/test/files/run/t0508.scala
index 7ef6f8197f..7ef6f8197f 100755
--- a/test/pending/run/t0508.scala
+++ b/test/files/run/t0508.scala