File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -996,7 +996,14 @@ trait Contexts { self: Analyzer =>
996996 if (settings.lint.value && selectors.nonEmpty && result != NoSymbol && pos != NoPosition )
997997 recordUsage(current, result)
998998
999- result
999+ // Harden against the fallout from bugs like SI-6745
1000+ //
1001+ // [JZ] I considered issuing a devWarning and moving the
1002+ // check inside the above loop, as I believe that
1003+ // this always represents a mistake on the part of
1004+ // the caller.
1005+ if (definitions isImportable result) result
1006+ else NoSymbol
10001007 }
10011008 private def selectorString (s : ImportSelector ): String = {
10021009 if (s.name == nme.WILDCARD && s.rename == null ) " _"
Original file line number Diff line number Diff line change 1+ import scala .tools .nsc ._
2+ import scala .tools .partest .CompilerTest
3+ import scala .collection .{ mutable , immutable , generic }
4+
5+ object Test extends CompilerTest {
6+ import global ._
7+ import rootMirror ._
8+ import definitions ._
9+ import global .analyzer .{Context , ImportInfo }
10+
11+ override def code = """
12+ package context {
13+ }
14+ """
15+
16+ def check (source : String , unit : global.CompilationUnit ) = {
17+ val context : Context = global.analyzer.rootContext(unit)
18+ val importInfo : ImportInfo = context.imports.head // Predef._
19+ val importedSym = importInfo.importedSymbol(nme.CONSTRUCTOR )
20+ assert(importedSym == NoSymbol , importedSym) // was "constructor Predef"
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments