aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Symbols.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-30 10:02:26 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-30 10:02:26 +0200
commit631bcbf60e326f0b9f597c709a4fcfdeade50ea3 (patch)
tree65e827f82b722ccd20036096b290e95a224d191d /src/dotty/tools/dotc/core/Symbols.scala
parenta0264e09c8da9a77e44ebc834142a13c186bde0d (diff)
downloaddotty-631bcbf60e326f0b9f597c709a4fcfdeade50ea3.tar.gz
dotty-631bcbf60e326f0b9f597c709a4fcfdeade50ea3.tar.bz2
dotty-631bcbf60e326f0b9f597c709a4fcfdeade50ea3.zip
Fixed logic in newTypeParams
gave a NPE before.
Diffstat (limited to 'src/dotty/tools/dotc/core/Symbols.scala')
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala15
1 files changed, 11 insertions, 4 deletions
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
}