Skip to content

Commit d8b3e8e

Browse files
authored
Merge pull request #2831 from dotty-staging/fix-java-info
Fix #2782: Force less things when parsing generic signatures
2 parents 26b852a + 3f2b82f commit d8b3e8e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

+12-4
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ class ClassfileParser(
296296
if (sig(index) == '<') {
297297
accept('<')
298298
var tp1: Type = tp
299-
var formals = tp.typeParamSymbols
299+
var formals: List[Symbol] =
300+
if (skiptvs)
301+
null
302+
else
303+
tp.typeParamSymbols
300304
while (sig(index) != '>') {
301305
sig(index) match {
302306
case variance @ ('+' | '-' | '*') =>
@@ -311,11 +315,15 @@ class ClassfileParser(
311315
else TypeBounds.lower(tp)
312316
case '*' => TypeBounds.empty
313317
}
314-
tp1 = RefinedType(tp1, formals.head.name, bounds)
318+
if (formals != null)
319+
tp1 = RefinedType(tp1, formals.head.name, bounds)
315320
case _ =>
316-
tp1 = RefinedType(tp1, formals.head.name, TypeAlias(sig2type(tparams, skiptvs)))
321+
val info = sig2type(tparams, skiptvs)
322+
if (formals != null)
323+
tp1 = RefinedType(tp1, formals.head.name, TypeAlias(info))
317324
}
318-
formals = formals.tail
325+
if (formals != null)
326+
formals = formals.tail
319327
}
320328
accept('>')
321329
tp1

0 commit comments

Comments
 (0)