@@ -349,12 +349,15 @@ class ClassfileParser(
349
349
val tag = sig(index); index += 1
350
350
(tag : @ switch) match {
351
351
case 'L' =>
352
- def processInner (tp : Type ): Type = tp match {
353
- case tp : TypeRef if ! tp.symbol.owner.is(Flags .ModuleClass ) =>
354
- TypeRef (processInner(tp.prefix.widen), tp.symbol.asType)
355
- case _ =>
356
- tp
357
- }
352
+ /** Inner class references of A.this.B into A#B, do the same transformation recursively on `A` */
353
+ def innerType (symbol : Symbol ): Type =
354
+ if symbol.is(Flags .Package ) then
355
+ ThisType .raw(TypeRef (NoPrefix , symbol.asType))
356
+ else if symbol.isType then
357
+ TypeRef (innerType(symbol.owner), symbol)
358
+ else
359
+ throw new RuntimeException (" unexpected term symbol " + symbol)
360
+
358
361
def processClassType (tp : Type ): Type = tp match {
359
362
case tp : TypeRef =>
360
363
if (sig(index) == '<' ) {
@@ -388,13 +391,13 @@ class ClassfileParser(
388
391
}
389
392
390
393
val classSym = classNameToSymbol(subName(c => c == ';' || c == '<' ))
391
- val classTpe = if (classSym eq defn.ObjectClass ) defn.FromJavaObjectType else classSym.typeRef
392
- var tpe = processClassType(processInner( classTpe) )
394
+ val classTpe = if (classSym eq defn.ObjectClass ) defn.FromJavaObjectType else innerType( classSym)
395
+ var tpe = processClassType(classTpe)
393
396
while (sig(index) == '.' ) {
394
397
accept('.' )
395
398
val name = subName(c => c == ';' || c == '<' || c == '.' ).toTypeName
396
399
val clazz = tpe.member(name).symbol
397
- tpe = processClassType(processInner( TypeRef (tpe, clazz) ))
400
+ tpe = processClassType(innerType( clazz))
398
401
}
399
402
accept(';' )
400
403
tpe
0 commit comments