[CSOptimizer] Reduce overload types before ranking

This would make sure that any same-type requirements to a concrete
type are substituted with such types which is especially important
for SIMD operators like `&{+, -}` because they have `Scalar == (U)Int*`
requirements.
This commit is contained in:
Pavel Yaskevich
2024-12-06 21:20:10 -08:00
parent 40a41c82d9
commit 95b47aead6

View File

@@ -780,6 +780,14 @@ static void determineBestChoicesInContext(
favorExactMatchesOnly = true;
}
// This is important for SIMD operators in particular because
// a lot of their overloads have same-type requires to a concrete
// type: `<Scalar == (U)Int*>(_: SIMD*<Scalar>, ...) -> ...`.
if (genericSig) {
overloadType = overloadType->getReducedType(genericSig)
->castTo<FunctionType>();
}
double score = 0.0;
unsigned numDefaulted = 0;
for (unsigned paramIdx = 0, n = overloadType->getNumParams();