@@ -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
/** Add moduleClass/sourceModule to completer if it is for a module val or class */
238
239
def adjustIfModule (completer : LazyType , tree : MemberDef ) =
239
240
if (tree.mods is Module ) ctx.adjustModuleCompleter(completer, tree.name.encode)
@@ -261,10 +262,10 @@ class Namer { typer: Typer =>
261
262
tree match {
262
263
case tree : TypeDef if tree.isClassDef =>
263
264
val name = checkNoConflict(tree.name.encode).asTypeName
264
- val cls = record (ctx.newClassSymbol(
265
+ val cls = recordSym (ctx.newClassSymbol(
265
266
ctx.owner, name, tree.mods.flags | inSuperCall,
266
267
cls => adjustIfModule(new ClassCompleter (cls, tree)(ctx), tree),
267
- privateWithinClass(tree.mods), tree.pos, ctx.source.file))
268
+ privateWithinClass(tree.mods), tree.pos, ctx.source.file), tree )
268
269
cls.completer.asInstanceOf [ClassCompleter ].init()
269
270
cls
270
271
case tree : MemberDef =>
@@ -290,13 +291,13 @@ class Namer { typer: Typer =>
290
291
// have no implementation.
291
292
val cctx = if (tree.name == nme.CONSTRUCTOR && ! (tree.mods is JavaDefined )) ctx.outer else ctx
292
293
293
- record (ctx.newSymbol(
294
+ recordSym (ctx.newSymbol(
294
295
ctx.owner, name, tree.mods.flags | deferred | method | higherKinded | inSuperCall1,
295
296
adjustIfModule(new Completer (tree)(cctx), tree),
296
- privateWithinClass(tree.mods), tree.pos))
297
+ privateWithinClass(tree.mods), tree.pos), tree )
297
298
case tree : Import =>
298
- record (ctx.newSymbol(
299
- ctx.owner, nme.IMPORT , Synthetic , new Completer (tree), NoSymbol , tree.pos))
299
+ recordSym (ctx.newSymbol(
300
+ ctx.owner, nme.IMPORT , Synthetic , new Completer (tree), NoSymbol , tree.pos), tree )
300
301
case _ =>
301
302
NoSymbol
302
303
}
@@ -564,7 +565,13 @@ class Namer { typer: Typer =>
564
565
565
566
val selfInfo =
566
567
if (self.isEmpty) NoType
567
- else if (cls is Module ) cls.owner.thisType select sourceModule
568
+ else if (cls.is(Module )) {
569
+ val moduleType = cls.owner.thisType select sourceModule
570
+ if (self.name == nme.WILDCARD ) moduleType
571
+ else recordSym(
572
+ ctx.newSymbol(cls, self.name, self.mods.flags, moduleType, coord = self.pos),
573
+ self)
574
+ }
568
575
else createSymbol(self)
569
576
570
577
// pre-set info, so that parent types can refer to type params
0 commit comments