@@ -102,9 +102,9 @@ class TypeSpecializer extends MiniPhaseTransform with InfoTransformer {
102
102
(implicit ctx : Context ): List [Symbol ] = {
103
103
val newSym =
104
104
ctx.newSymbol(decl.owner, (decl.name + names.mkString).toTermName,
105
- decl.flags | Flags .Synthetic ,poly.instantiate(instantiations.toList))
106
- // poly.derivedPolyType(poly.paramNames, poly.paramBounds,
107
- // poly.instantiate(instantiations.toList)))
105
+ decl.flags | Flags .Synthetic ,
106
+ poly.derivedPolyType(poly.paramNames, poly.paramBounds,
107
+ poly.instantiate(instantiations.toList)))
108
108
val map = newSymbolMap.getOrElse(decl, mutable.HashMap .empty)
109
109
map.put(instantiations, newSym)
110
110
newSymbolMap.put(decl, map)
@@ -152,34 +152,38 @@ class TypeSpecializer extends MiniPhaseTransform with InfoTransformer {
152
152
def specialize (decl : Symbol ): List [Tree ] = {
153
153
if (newSymbolMap.contains(decl)) {
154
154
val declSpecs = newSymbolMap(decl)
155
-
155
+ var failedSpec : List [ Symbol ] = List ()
156
156
val newSyms = declSpecs.values.toList
157
157
val instantiations = declSpecs.keys.toArray
158
158
var index = - 1
159
159
println(s " specializing ${tree.symbol} for $origTParams" )
160
160
/* val attempted = newSyms.zip(*/ newSyms.map { newSym =>
161
- index += 1
162
- polyDefDef(newSym.asTerm, { tparams => vparams => {
163
- // assert(tparams.isEmpty)
164
-
165
- val tmap : (Tree => Tree ) = _ match {
166
- case Return (t, from) if from.symbol == tree.symbol => Return (t, ref(newSym))
167
- case t : TypeApply => transformTypeApply(t)
168
- case t => t
169
- }
170
-
171
- new TreeTypeMap (
172
- treeMap = tmap,
173
- typeMap = _
161
+ index += 1
162
+ polyDefDef(newSym.asTerm, { tparams => vparams => {
163
+ // assert(tparams.isEmpty)
164
+
165
+ val tmap : (Tree => Tree ) = _ match {
166
+ case Return (t, from) if from.symbol == tree.symbol => Return (t, ref(newSym))
167
+ case t : TypeApply => transformTypeApply(t)
168
+ case t => t
169
+ }
170
+
171
+ new TreeTypeMap (
172
+ treeMap = tmap,
173
+ typeMap = _ /* match {
174
+ case t if !poly.bounds.contains(t) => {
175
+ failedSpec = newSym :: failedSpec
176
+ t
177
+ }
178
+ case t => t*/
174
179
.substDealias(origTParams, instantiations(index))
175
180
.subst(origVParams, vparams.flatten.map(_.tpe))
176
- ,
177
- oldOwners = tree.symbol :: Nil ,
178
- newOwners = newSym :: Nil
179
- ).transform(tree.rhs)
180
- }
181
- })
182
- }// )
181
+ ,
182
+ oldOwners = tree.symbol :: Nil ,
183
+ newOwners = newSym :: Nil
184
+ ).transform(tree.rhs)
185
+ }})
186
+ }// )
183
187
// attempted.filterNot(a => failedSpec.contains(a._1)).map(_._2)
184
188
} else Nil
185
189
}
@@ -221,16 +225,4 @@ class TypeSpecializer extends MiniPhaseTransform with InfoTransformer {
221
225
} else tree
222
226
} else tree
223
227
}
224
- }
225
-
226
- /**
227
- * var failedSpec: List[Symbol] = List()
228
- *
229
- *
230
- * match {
231
- case t if !poly.bounds.contains(t) => {
232
- failedSpec = newSym :: failedSpec
233
- t
234
- }
235
- case t => t
236
- */
228
+ }
0 commit comments