Skip to content

Commit

Permalink
a micro-optimization
Browse files Browse the repository at this point in the history
Summary: - elimmedLower can be computed once

Reviewed By: VLanvin

Differential Revision: D61597351

fbshipit-source-id: 613b061dc3c895e9f0572cd3c5f42c7078b6bbf2
  • Loading branch information
ilya-klyuchnikov authored and facebook-github-bot committed Aug 21, 2024
1 parent bf70997 commit 58539d4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 58539d4

Please sign in to comment.