@@ -216,6 +216,17 @@ class Namer { typer: Typer =>
216216 }
217217 }
218218
219+ /** Record `sym` as the symbol defined by `tree` */
220+ def recordSym (sym : Symbol , tree : Tree )(implicit ctx : Context ): Symbol = {
221+ val refs = tree.attachmentOrElse(References , Nil )
222+ if (refs.nonEmpty) {
223+ tree.removeAttachment(References )
224+ refs foreach (_.pushAttachment(OriginalSymbol , sym))
225+ }
226+ tree.pushAttachment(SymOfTree , sym)
227+ sym
228+ }
229+
219230 /** If this tree is a member def or an import, create a symbol of it
220231 * and store in symOfTree map.
221232 */
@@ -224,16 +235,6 @@ class Namer { typer: Typer =>
224235 def privateWithinClass (mods : Modifiers ) =
225236 enclosingClassNamed(mods.privateWithin, mods.pos)
226237
227- def record (sym : Symbol ): Symbol = {
228- val refs = tree.attachmentOrElse(References , Nil )
229- if (refs.nonEmpty) {
230- tree.removeAttachment(References )
231- refs foreach (_.pushAttachment(OriginalSymbol , sym))
232- }
233- tree.pushAttachment(SymOfTree , sym)
234- sym
235- }
236-
237238 def checkFlags (flags : FlagSet ) =
238239 if (flags.isEmpty) flags
239240 else {
@@ -274,10 +275,10 @@ class Namer { typer: Typer =>
274275 case tree : TypeDef if tree.isClassDef =>
275276 val name = checkNoConflict(tree.name.encode).asTypeName
276277 val flags = checkFlags(tree.mods.flags &~ Implicit )
277- val cls = record (ctx.newClassSymbol(
278+ val cls = recordSym (ctx.newClassSymbol(
278279 ctx.owner, name, flags | inSuperCall,
279280 cls => adjustIfModule(new ClassCompleter (cls, tree)(ctx), tree),
280- privateWithinClass(tree.mods), tree.pos, ctx.source.file))
281+ privateWithinClass(tree.mods), tree.pos, ctx.source.file), tree )
281282 cls.completer.asInstanceOf [ClassCompleter ].init()
282283 cls
283284 case tree : MemberDef =>
@@ -304,13 +305,13 @@ class Namer { typer: Typer =>
304305 // have no implementation.
305306 val cctx = if (tree.name == nme.CONSTRUCTOR && ! (tree.mods is JavaDefined )) ctx.outer else ctx
306307
307- record (ctx.newSymbol(
308+ recordSym (ctx.newSymbol(
308309 ctx.owner, name, flags | deferred | method | higherKinded | inSuperCall1,
309310 adjustIfModule(new Completer (tree)(cctx), tree),
310- privateWithinClass(tree.mods), tree.pos))
311+ privateWithinClass(tree.mods), tree.pos), tree )
311312 case tree : Import =>
312- record (ctx.newSymbol(
313- ctx.owner, nme.IMPORT , Synthetic , new Completer (tree), NoSymbol , tree.pos))
313+ recordSym (ctx.newSymbol(
314+ ctx.owner, nme.IMPORT , Synthetic , new Completer (tree), NoSymbol , tree.pos), tree )
314315 case _ =>
315316 NoSymbol
316317 }
@@ -579,7 +580,13 @@ class Namer { typer: Typer =>
579580
580581 val selfInfo =
581582 if (self.isEmpty) NoType
582- else if (cls is Module ) cls.owner.thisType select sourceModule
583+ else if (cls.is(Module )) {
584+ val moduleType = cls.owner.thisType select sourceModule
585+ if (self.name == nme.WILDCARD ) moduleType
586+ else recordSym(
587+ ctx.newSymbol(cls, self.name, self.mods.flags, moduleType, coord = self.pos),
588+ self)
589+ }
583590 else createSymbol(self)
584591
585592 // pre-set info, so that parent types can refer to type params
0 commit comments