File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2266,6 +2266,18 @@ namespace {
2266
2266
if (!choice.isImplicitlyUnwrappedValueOrReturnValue ())
2267
2267
return false ;
2268
2268
2269
+ // If we have an IUO function call and don't have a disjunction choice,
2270
+ // then it means we didn't create a disjunction because the call was
2271
+ // wrapped in parens (i.e. '(s.returnsAnIUO)()') and so there's no
2272
+ // need to force unwrap.
2273
+ if (!solution.DisjunctionChoices .count (
2274
+ cs.getConstraintLocator (locator))) {
2275
+ auto type = choice.getDecl ()->getInterfaceType ();
2276
+ assert ((type && type->is <AnyFunctionType>()) &&
2277
+ " expected a function type" );
2278
+ return false ;
2279
+ }
2280
+
2269
2281
auto *choiceLocator = cs.getConstraintLocator (locator.withPathElement (
2270
2282
ConstraintLocator::ImplicitlyUnwrappedDisjunctionChoice));
2271
2283
You can’t perform that action at this time.
0 commit comments