From 350f4abecd78ba9ed9aca86022deb8a9992586a5 Mon Sep 17 00:00:00 2001 From: David MacIver Date: Thu, 4 Sep 2008 13:54:09 +0000 Subject: 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. --- src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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) => -- cgit v1.2.3