Skip to content

Commit 6778e3c

Browse files
committed
Slight optimization
1 parent 8efdbdc commit 6778e3c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,21 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
280280
* or to make them equal, by instantiating uninstantiated type variables.
281281
*/
282282
def homogenizedUnion(tp1: Type, tp2: Type): Type = {
283-
def fitInto(tp1: Type, tp2: Type): Unit = tp1 match {
283+
tp1 match {
284284
case tp1: TypeBounds =>
285285
tp2 match {
286286
case tp2: TypeBounds =>
287-
val nestedCtx = ctx.fresh.setNewTyperState
288-
if (tp2.boundsInterval.contains(tp1.boundsInterval)(nestedCtx))
289-
nestedCtx.typerState.commit()
287+
def fitInto(tp1: TypeBounds, tp2: TypeBounds): Unit = {
288+
val nestedCtx = ctx.fresh.setNewTyperState
289+
if (tp2.boundsInterval.contains(tp1.boundsInterval)(nestedCtx))
290+
nestedCtx.typerState.commit()
291+
}
292+
fitInto(tp1, tp2)
293+
fitInto(tp2, tp1)
290294
case _ =>
291295
}
292296
case _ =>
293297
}
294-
fitInto(tp1, tp2)
295-
fitInto(tp2, tp1)
296298
tp1 | tp2
297299
}
298300

0 commit comments

Comments
 (0)