summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-05-23 20:36:30 +0000
committerPaul Phillips <paulp@improving.org>2011-05-23 20:36:30 +0000
commitd3ff7ee9fcac1d10c145bbd1f37a69b989a73cdf (patch)
treed70b1a6a6d73827748f2a7a95d2846867ce12983 /src
parente6b0beaa4c41a46bb9eb492f3fad6ff6589fa5ea (diff)
downloadscala-d3ff7ee9fcac1d10c145bbd1f37a69b989a73cdf.tar.gz
scala-d3ff7ee9fcac1d10c145bbd1f37a69b989a73cdf.tar.bz2
scala-d3ff7ee9fcac1d10c145bbd1f37a69b989a73cdf.zip
Fix for failing { val x = classOf[List[_]] } in...
Fix for failing { val x = classOf[List[_]] } introduced by paulp in r23262. I already had this in mind (see comments of #4419) but I was holding back in the runup to 2.9. Closes #4419, review by odersky.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 8f20f2a120..bc6a468538 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -614,7 +614,7 @@ trait Namers { self: Analyzer =>
* modifier is the present means of signaling that a constant
* value should not be widened, so it has a use even in situations
* whether it is otherwise redundant (such as in a singleton.)
- * Locally defined symbols are also excluded from widening.
+ * Method-defined locals are also excluded from widening.
*/
private def widenIfNecessary(sym: Symbol, tpe: Type, pt: Type): Type = {
val getter =
@@ -636,7 +636,7 @@ trait Namers { self: Analyzer =>
if ((sym.isVariable || sym.isMethod && !sym.hasAccessorFlag))
if (tpe2 <:< pt) tpe2 else tpe1
else if (isHidden(tpe)) tpe2
- else if (sym.isFinal || sym.isLocal) tpe
+ else if (sym.isFinal || sym.owner.isMethod) tpe
else tpe1
}