From 58539d41ebb19140fd3ab8b04c00f2e5152ed97a Mon Sep 17 00:00:00 2001 From: Ilya Klyuchnikov Date: Wed, 21 Aug 2024 07:50:35 -0700 Subject: [PATCH] a micro-optimization Summary: - elimmedLower can be computed once Reviewed By: VLanvin Differential Revision: D61597351 fbshipit-source-id: 613b061dc3c895e9f0572cd3c5f42c7078b6bbf2 --- .../scala/com/whatsapp/eqwalizer/tc/generics/Constraints.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/generics/Constraints.scala b/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/generics/Constraints.scala index 589e203..1a54c00 100644 --- a/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/generics/Constraints.scala +++ b/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/generics/Constraints.scala @@ -161,9 +161,9 @@ class Constraints(pipelineContext: PipelineContext) { constrainSeq(state, tys.map((_, upperBound))) // when the upper bound is a union, see if there is only one potential match, use it for constraint generation case (_, UnionType(tys)) => + val elimmedLower = ElimTypeVars.elimTypeVars(lowerBound, ElimTypeVars.Demote, toSolve ++ varsToElim) val candidates = tys.filter { ty => val elimmedUpper = ElimTypeVars.elimTypeVars(ty, ElimTypeVars.Promote, toSolve ++ varsToElim) - val elimmedLower = ElimTypeVars.elimTypeVars(lowerBound, ElimTypeVars.Demote, toSolve ++ varsToElim) subtype.subType(elimmedLower, elimmedUpper) }.toList val (varTypes, others) = candidates.partition {