From 631bcbf60e326f0b9f597c709a4fcfdeade50ea3 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 30 Sep 2013 10:02:26 +0200 Subject: Fixed logic in newTypeParams gave a NPE before. --- src/dotty/tools/dotc/core/Symbols.scala | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 1f8c475ab..7869f75b9 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -225,11 +225,18 @@ trait Symbols { this: Context => names: List[TypeName], flags: FlagSet, boundsFn: List[TypeRef] => List[Type]): List[TypeSymbol] = { - val tparams = names map (_ => newNakedSymbol[TypeName](NoCoord)) - val bounds = boundsFn(tparams map (_.symTypeRef)) - (names, tparams, bounds).zipped foreach { (name, tparam, bound) => - tparam.denot = SymDenotation(tparam, owner, name, flags | TypeParamCreationFlags, bound) + + val tparamBuf = new mutable.ListBuffer[TypeSymbol] + val trefBuf = new mutable.ListBuffer[TypeRef] + for (name <- names) { + val tparam = newNakedSymbol[TypeName](NoCoord) + tparamBuf += tparam + trefBuf += TypeRef.withSym(owner.thisType, name, tparam) } + val tparams = tparamBuf.toList + val bounds = boundsFn(trefBuf.toList) + for ((name, tparam, bound) <- (names, tparams, bounds).zipped) + tparam.denot = SymDenotation(tparam, owner, name, flags | TypeParamCreationFlags, bound) tparams } -- cgit v1.2.3