@@ -349,13 +349,19 @@ 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
- }
358
- def processClassType (tp : Type ): Type = tp match {
352
+ /** A type representation where inner classes become `A#B` instead of `A.this.B` (like with `typeRef`)
353
+ *
354
+ * Note: the symbol must not be nested in a generic class.
355
+ */
356
+ def innerType (symbol : Symbol ): Type =
357
+ if symbol.is(Flags .Package ) then
358
+ symbol.thisType
359
+ else if symbol.isType then
360
+ TypeRef (innerType(symbol.owner), symbol)
361
+ else
362
+ throw new RuntimeException (" unexpected term symbol " + symbol)
363
+
364
+ def processTypeArgs (tp : Type ): Type = tp match {
359
365
case tp : TypeRef =>
360
366
if (sig(index) == '<' ) {
361
367
accept('<' )
@@ -388,13 +394,13 @@ class ClassfileParser(
388
394
}
389
395
390
396
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) )
397
+ val classTpe = if (classSym eq defn.ObjectClass ) defn.FromJavaObjectType else innerType( classSym)
398
+ var tpe = processTypeArgs( classTpe)
393
399
while (sig(index) == '.' ) {
394
400
accept('.' )
395
401
val name = subName(c => c == ';' || c == '<' || c == '.' ).toTypeName
396
- val clazz = tpe.member (name).symbol
397
- tpe = processClassType(processInner( TypeRef (tpe, clazz)) )
402
+ val tp = tpe.select (name)
403
+ tpe = processTypeArgs(tp )
398
404
}
399
405
accept(';' )
400
406
tpe
@@ -432,15 +438,15 @@ class ClassfileParser(
432
438
paramtypes += {
433
439
if isRepeatedParam(index) then
434
440
index += 1
435
- val elemType = sig2type(tparams, skiptvs)
441
+ val elemType = sig2type(tparams, skiptvs = false )
436
442
// `ElimRepeated` is responsible for correctly erasing this.
437
443
defn.RepeatedParamType .appliedTo(elemType)
438
444
else
439
- sig2type(tparams, skiptvs)
445
+ sig2type(tparams, skiptvs = false )
440
446
}
441
447
442
448
index += 1
443
- val restype = sig2type(tparams, skiptvs)
449
+ val restype = sig2type(tparams, skiptvs = false )
444
450
JavaMethodType (paramnames.toList, paramtypes.toList, restype)
445
451
case 'T' =>
446
452
val n = subName(';' .== ).toTypeName
0 commit comments