From 3f2b82fc6d04b206d33a3fab58ff6aba6fe5780f Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 5 Jul 2017 10:18:18 +0200 Subject: [PATCH] Fix #2782: Force less things when parsing generic signatures --- .../dotc/core/classfile/ClassfileParser.scala | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index 59e0fdcb4b02..b706ea78214a 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -296,7 +296,11 @@ class ClassfileParser( if (sig(index) == '<') { accept('<') var tp1: Type = tp - var formals = tp.typeParamSymbols + var formals: List[Symbol] = + if (skiptvs) + null + else + tp.typeParamSymbols while (sig(index) != '>') { sig(index) match { case variance @ ('+' | '-' | '*') => @@ -311,11 +315,15 @@ class ClassfileParser( else TypeBounds.lower(tp) case '*' => TypeBounds.empty } - tp1 = RefinedType(tp1, formals.head.name, bounds) + if (formals != null) + tp1 = RefinedType(tp1, formals.head.name, bounds) case _ => - tp1 = RefinedType(tp1, formals.head.name, TypeAlias(sig2type(tparams, skiptvs))) + val info = sig2type(tparams, skiptvs) + if (formals != null) + tp1 = RefinedType(tp1, formals.head.name, TypeAlias(info)) } - formals = formals.tail + if (formals != null) + formals = formals.tail } accept('>') tp1