Skip to content

Commit e194cd9

Browse files
committed
SI-4043 Share code in etaExpand and inferPolyAlternatives
Part II, remove the old implementation.
1 parent db1dc6c commit e194cd9

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/compiler/scala/tools/nsc/typechecker/Infer.scala

+1-5
Original file line numberDiff line numberDiff line change
@@ -1446,11 +1446,7 @@ trait Infer extends Checkable {
14461446
log(s"Attaching AntiPolyType-carrying overloaded type to $sym")
14471447
// Multiple alternatives which are within bounds; spin up an
14481448
// overloaded type which carries an "AntiPolyType" as a prefix.
1449-
val tparams = newAsSeenFromMap(pre, hd.owner) mapOver hd.typeParams
1450-
val bounds = tparams map (_.tpeHK) // see e.g., #1236
1451-
val tpe = PolyType(tparams, OverloadedType(AntiPolyType(pre, bounds), alts))
1452-
val tpe1 = typeFunAnonSeenFrom(pre, hd, hd.typeParams, (bounds: List[Type]) => OverloadedType(AntiPolyType(pre, bounds), alts))
1453-
assert(tpe.matches(tpe1) && tpe1.matches(tpe1))
1449+
val tpe = typeFunAnonSeenFrom(pre, hd, hd.typeParams, (bounds: List[Type]) => OverloadedType(AntiPolyType(pre, bounds), alts))
14541450
finish(sym setInfo tpe, tpe)
14551451
}
14561452
matchingLength.alternatives match {

src/reflect/scala/reflect/internal/Types.scala

+1-9
Original file line numberDiff line numberDiff line change
@@ -2182,15 +2182,7 @@ trait Types
21822182
val tpars = initializedTypeParams
21832183
if (tpars.isEmpty) this
21842184
else {
2185-
val map = newAsSeenFromMap(pre, sym.owner)
2186-
val tpars1 = map.mapOver(tpars)
2187-
val tp = if (tpars eq tpars1)
2188-
typeFunAnon(tpars, copyTypeRef(this, pre, sym, tpars map (_.tpeHK)))
2189-
else
2190-
typeFunAnon(tpars1, copyTypeRef(this, pre, sym, tpars map (_.tpeHK.substSym(tpars, tpars1))))
2191-
val tp1 = typeFunAnonSeenFrom(pre, sym, tpars, bounds => copyTypeRef(this, pre, sym, bounds))
2192-
assert(tp.matches(tp) && tp1.matches(tp1))
2193-
tp
2185+
typeFunAnonSeenFrom(pre, sym, tpars, bounds => copyTypeRef(this, pre, sym, bounds))
21942186
} // todo: also beta-reduce?
21952187
}
21962188

0 commit comments

Comments
 (0)