@@ -216,6 +216,17 @@ class Namer { typer: Typer =>
216
216
}
217
217
}
218
218
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
+
219
230
/** If this tree is a member def or an import, create a symbol of it
220
231
* and store in symOfTree map.
221
232
*/
@@ -224,16 +235,6 @@ class Namer { typer: Typer =>
224
235
def privateWithinClass (mods : Modifiers ) =
225
236
enclosingClassNamed(mods.privateWithin, mods.pos)
226
237
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
-
237
238
def checkFlags (flags : FlagSet ) =
238
239
if (flags.isEmpty) flags
239
240
else {
@@ -274,10 +275,10 @@ class Namer { typer: Typer =>
274
275
case tree : TypeDef if tree.isClassDef =>
275
276
val name = checkNoConflict(tree.name.encode).asTypeName
276
277
val flags = checkFlags(tree.mods.flags &~ Implicit )
277
- val cls = record (ctx.newClassSymbol(
278
+ val cls = recordSym (ctx.newClassSymbol(
278
279
ctx.owner, name, flags | inSuperCall,
279
280
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 )
281
282
cls.completer.asInstanceOf [ClassCompleter ].init()
282
283
cls
283
284
case tree : MemberDef =>
@@ -304,13 +305,13 @@ class Namer { typer: Typer =>
304
305
// have no implementation.
305
306
val cctx = if (tree.name == nme.CONSTRUCTOR && ! (tree.mods is JavaDefined )) ctx.outer else ctx
306
307
307
- record (ctx.newSymbol(
308
+ recordSym (ctx.newSymbol(
308
309
ctx.owner, name, flags | deferred | method | higherKinded | inSuperCall1,
309
310
adjustIfModule(new Completer (tree)(cctx), tree),
310
- privateWithinClass(tree.mods), tree.pos))
311
+ privateWithinClass(tree.mods), tree.pos), tree )
311
312
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 )
314
315
case _ =>
315
316
NoSymbol
316
317
}
@@ -579,7 +580,13 @@ class Namer { typer: Typer =>
579
580
580
581
val selfInfo =
581
582
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
+ }
583
590
else createSymbol(self)
584
591
585
592
// pre-set info, so that parent types can refer to type params
0 commit comments