From ff7416d88b67b26c5f066ef08801517c09bd2859 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 10 Aug 2011 00:56:07 +0000 Subject: Expanded the range of a warning, and made suppr... Expanded the range of a warning, and made suppressed warnings visible. Modified the positioning of "permanently hidden" errors so that when there is more than one, the later ones are not ignored. Also changed the error suppression code to emit the error anyway if -Ydebug was given (it is prefixed with "[suppressed] ".) Since I can't be the only one who wondered where his errors were vanishing to. No review. --- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala') diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 2ebfdc7426..a94205e07a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -315,6 +315,7 @@ trait Namers { self: Analyzer => } def check(to: Name) = { val e = context.scope.lookupEntry(to) + if (e != null && e.owner == context.scope && e.sym.exists) warnRedundant(e.sym) else if (context ne context.enclClass) { @@ -334,7 +335,7 @@ trait Namers { self: Analyzer => } } def checkSelector(s: ImportSelector) = { - val ImportSelector(from, _, to, _) = s + val ImportSelector(from, fromPos, to, _) = s if (from != nme.WILDCARD && base != ErrorType) { if (isValid(from)) { if (currentRun.compileSourceFor(expr, from)) { @@ -345,7 +346,10 @@ trait Namers { self: Analyzer => else if (!nme.isModuleName(from) || isValid(nme.stripModuleSuffix(from))) notAMemberError(tree.pos, expr, from) } - checkNotRedundant(tree.pos, from, to) + // Setting the position at the import means that if there is more + // than one hidden names, the second will not be warned + // So it is the position of the actual hidden name. + checkNotRedundant(tree.pos withPoint fromPos, from, to) } } def noDuplicates(names: List[Name], message: String) { -- cgit v1.2.3