File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -701,6 +701,8 @@ static void determineBestChoicesInContext(
701
701
llvm::TinyPtrVector<Type> resultTypes;
702
702
703
703
bool hasArgumentCandidates = false ;
704
+ bool isOperator = isOperatorDisjunction(disjunction);
705
+
704
706
for (unsigned i = 0 , n = argFuncType->getNumParams (); i != n; ++i) {
705
707
const auto ¶m = argFuncType->getParams ()[i];
706
708
auto argType = cs.simplifyType (param.getPlainType ());
@@ -759,6 +761,17 @@ static void determineBestChoicesInContext(
759
761
// a type for the second operand of `+` based on a type being
760
762
// constructed.
761
763
if (typeVar->getImpl ().isFunctionResult ()) {
764
+ auto *resultLoc = typeVar->getImpl ().getLocator ();
765
+
766
+ // We don't want to try and infer parts of operator
767
+ // chains.
768
+ if (!isOperator) {
769
+ if (auto type = inferTypeOfArithmeticOperatorChain (
770
+ cs.DC , resultLoc->getAnchor ())) {
771
+ types.push_back ({type, /* fromLiteral=*/ true });
772
+ }
773
+ }
774
+
762
775
auto binding =
763
776
inferTypeFromInitializerResultType (cs, typeVar, disjunctions);
764
777
You can’t perform that action at this time.
0 commit comments