Skip to content

Commit ed47913

Browse files
committed
Unfold yet another use of bounds case class
We save one `map`, and may avoid creating a lot of unused `TypeBounds` objects that are later discarded.
1 parent 144c01d commit ed47913

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/reflect/scala/reflect/internal/tpe/GlbLubs.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,12 @@ private[internal] trait GlbLubs {
328328
else if (symtypes.tail forall (symtypes.head =:= _))
329329
proto.cloneSymbol(lubRefined.typeSymbol).setInfoOwnerAdjusted(symtypes.head)
330330
else {
331-
def lubBounds(bnds: List[TypeBounds]): TypeBounds =
332-
TypeBounds(glb(bnds map (_.lo), depth.decr), lub(bnds map (_.hi), depth.decr))
331+
val lubBs = TypeBounds(
332+
glb(symtypes.map(_.lowerBound), depth.decr),
333+
lub(symtypes.map(_.upperBound), depth.decr)
334+
)
333335
lubRefined.typeSymbol.newAbstractType(proto.name.toTypeName, proto.pos)
334-
.setInfoOwnerAdjusted(lubBounds(symtypes map (_.bounds)))
336+
.setInfoOwnerAdjusted(lubBs)
335337
}
336338
}
337339
}

0 commit comments

Comments
 (0)