File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -4413,9 +4413,16 @@ Solution::getFunctionArgApplyInfo(ConstraintLocator *locator) const {
4413
4413
// If we didn't resolve an overload for the callee, we should be dealing
4414
4414
// with a call of an arbitrary function expr.
4415
4415
auto *call = castToExpr<CallExpr>(anchor);
4416
+ rawFnType = getType (call->getFn ());
4417
+
4418
+ // If callee couldn't be resolved due to expression
4419
+ // issues e.g. it's a reference to an invalid member
4420
+ // let's just return here.
4421
+ if (simplifyType (rawFnType)->is <UnresolvedType>())
4422
+ return None;
4423
+
4416
4424
assert (!shouldHaveDirectCalleeOverload (call) &&
4417
4425
" Should we have resolved a callee for this?" );
4418
- rawFnType = getType (call->getFn ());
4419
4426
}
4420
4427
4421
4428
// Try to resolve the function type by loading lvalues and looking through
Original file line number Diff line number Diff line change @@ -1042,3 +1042,17 @@ let explicitUnboundResult2: (Array<Bool>) -> Array<Int> = {
1042
1042
let explicitUnboundResult3 : ( Array < Bool > ) -> Array < Int > = {
1043
1043
( arr: Array ) -> Array in [ true ]
1044
1044
}
1045
+
1046
+ // rdar://problem/71525503 - Assertion failed: (!shouldHaveDirectCalleeOverload(call) && "Should we have resolved a callee for this?")
1047
+ func test_inout_with_invalid_member_ref( ) {
1048
+ struct S {
1049
+ static func createS( _ arg: inout Int ) -> S { S ( ) }
1050
+ }
1051
+ class C {
1052
+ static subscript( s: ( Int ) -> Void ) -> Bool { get { return false } }
1053
+ }
1054
+
1055
+ let _: Bool = C [ { . createS( & $0) } ]
1056
+ // expected-error@-1 {{value of tuple type 'Void' has no member 'createS'}}
1057
+ // expected-error@-2 {{cannot pass immutable value as inout argument: '$0' is immutable}}
1058
+ }
You can’t perform that action at this time.
0 commit comments