@@ -178,25 +178,25 @@ class TreeTypeMap(
178178 * and return a treemap that contains the substitution
179179 * between original and mapped symbols.
180180 */
181- def withMappedSyms (syms : List [Symbol ], mapAlways : Boolean = false ): TreeTypeMap =
182- withMappedSyms(syms, mapSymbols(syms, this , mapAlways ))
181+ def withMappedSyms (syms : List [Symbol ]): TreeTypeMap =
182+ withMappedSyms(syms, mapSymbols(syms, this ))
183183
184184 /** The tree map with the substitution between originals `syms`
185185 * and mapped symbols `mapped`. Also goes into mapped classes
186186 * and substitutes their declarations.
187187 */
188188 def withMappedSyms (syms : List [Symbol ], mapped : List [Symbol ]): TreeTypeMap =
189- val symsChanged = syms ne mapped
190- val substMap = withSubstitution(syms, mapped)
191- lazy val origCls = mapped.zip (syms).filter(_._1.isClass).toMap
192- mapped.filter(_.isClass).foldLeft(substMap) { (tmap, cls) =>
193- val origDcls = cls.info.decls.toList.filterNot (_.is( TypeParam ))
194- val mappedDcls = mapSymbols(origDcls, tmap )
195- val tmap1 = tmap.withMappedSyms(
196- origCls(cls).typeParams ::: origDcls,
197- cls.typeParams ::: mappedDcls)
198- if symsChanged then
189+ if syms eq mapped then this
190+ else
191+ val substMap = withSubstitution (syms, mapped)
192+ lazy val origCls = mapped.zip(syms). filter(_._1. isClass).toMap
193+ mapped.filter (_.isClass).foldLeft(substMap) { (tmap, cls) =>
194+ val origDcls = cls.info.decls.toList.filterNot(_.is( TypeParam ) )
195+ val mappedDcls = mapSymbols(origDcls, tmap, mapAlways = true )
196+ val tmap1 = tmap.withMappedSyms(
197+ origCls( cls) .typeParams ::: origDcls,
198+ cls.typeParams ::: mappedDcls)
199199 origDcls.lazyZip(mappedDcls).foreach(cls.asClass.replace)
200- tmap1
201- }
200+ tmap1
201+ }
202202}
0 commit comments