summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/backend/MSILPlatform.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala1
-rw-r--r--src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala8
-rw-r--r--test/files/neg/permanent-blindness.check10
-rw-r--r--test/files/neg/permanent-blindness.flags1
-rw-r--r--test/files/neg/permanent-blindness.scala22
7 files changed, 47 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala b/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala
index 1606e6b1d0..9781111004 100644
--- a/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala
+++ b/src/compiler/scala/tools/nsc/backend/MSILPlatform.scala
@@ -12,7 +12,7 @@ import msil.GenMSIL
trait MSILPlatform extends Platform[MSILType] {
import global._
- import definitions.{ ComparatorClass, BoxedNumberClass, getMember, getClass }
+ import definitions.{ ComparatorClass, BoxedNumberClass, getMember }
if (settings.verbose.value)
inform("[AssemRefs = " + settings.assemrefs.value + "]")
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
index fb5a93fdc8..888413257f 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -26,7 +26,6 @@ package icode
trait TypeKinds { self: ICodes =>
import global._
import definitions.{ ArrayClass, AnyRefClass, ObjectClass, NullClass, NothingClass, arrayType }
- import icodes.{ checkerDebug, NothingReference, NullReference }
/** A map from scala primitive Types to ICode TypeKinds */
lazy val primitiveTypeMap: Map[Symbol, TypeKind] = {
diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
index cad69deb7b..2ba8c8eb6b 100644
--- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
@@ -42,8 +42,13 @@ abstract class AbstractReporter extends Reporter {
val hidden = testAndLog(pos, severity)
if (severity == WARNING && noWarnings) ()
else {
- if (!hidden || isPromptSet) display(pos, msg, severity)
- if (isPromptSet) displayPrompt
+ if (!hidden || isPromptSet)
+ display(pos, msg, severity)
+ else if (settings.debug.value)
+ display(pos, "[ suppressed ] " + msg, severity)
+
+ if (isPromptSet)
+ displayPrompt
}
}
}
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) {
diff --git a/test/files/neg/permanent-blindness.check b/test/files/neg/permanent-blindness.check
new file mode 100644
index 0000000000..18b4543707
--- /dev/null
+++ b/test/files/neg/permanent-blindness.check
@@ -0,0 +1,10 @@
+permanent-blindness.scala:10: error: imported `Bippy' is permanently hidden by definition of class Bippy in package bar
+ import foo.{ Bippy, Bop, Dingus }
+ ^
+permanent-blindness.scala:10: error: imported `Bop' is permanently hidden by definition of object Bop in package bar
+ import foo.{ Bippy, Bop, Dingus }
+ ^
+permanent-blindness.scala:10: error: imported `Dingus' is permanently hidden by definition of object Dingus in package bar
+ import foo.{ Bippy, Bop, Dingus }
+ ^
+three errors found
diff --git a/test/files/neg/permanent-blindness.flags b/test/files/neg/permanent-blindness.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/permanent-blindness.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/permanent-blindness.scala b/test/files/neg/permanent-blindness.scala
new file mode 100644
index 0000000000..b6d09d6dce
--- /dev/null
+++ b/test/files/neg/permanent-blindness.scala
@@ -0,0 +1,22 @@
+package foo {
+ class Bippy
+ object Bop {
+ def fff = 5
+ }
+ object Dingus
+}
+
+package bar {
+ import foo.{ Bippy, Bop, Dingus }
+
+ class Bippy
+ object Bop
+ object Dingus
+
+
+ class Ding {
+ def fff = 5
+
+ def g = new Bippy
+ }
+} \ No newline at end of file