aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Namer.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Namer.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index 1b6e437b5..068ef3e4b 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -373,8 +373,13 @@ class Namer { typer: Typer =>
}
/** A new context that summarizes an import statement */
- def importContext(sym: Symbol, selectors: List[Tree])(implicit ctx: Context) =
- ctx.fresh.setImportInfo(new ImportInfo(sym, selectors))
+ def importContext(imp: Import, sym: Symbol)(implicit ctx: Context) = {
+ val impNameOpt = imp.expr match {
+ case ref: RefTree => Some(ref.name.asTermName)
+ case _ => None
+ }
+ ctx.fresh.setImportInfo(new ImportInfo(sym, imp.selectors, impNameOpt))
+ }
/** A new context for the interior of a class */
def inClassContext(selfInfo: DotClass /* Should be Type | Symbol*/)(implicit ctx: Context): Context = {
@@ -423,7 +428,7 @@ class Namer { typer: Typer =>
setDocstring(pkg, stat)
ctx
case imp: Import =>
- importContext(createSymbol(imp), imp.selectors)
+ importContext(imp, createSymbol(imp))
case mdef: DefTree =>
val sym = enterSymbol(createSymbol(mdef))
setDocstring(sym, origStat)