File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -385,15 +385,18 @@ class AbstractFunction {
385
385
386
386
Type getType () const {
387
387
switch (getKind ()) {
388
- case Kind::Opaque: return getOpaqueFunction ()->getType ();
388
+ case Kind::Opaque:
389
+ return getOpaqueFunction ()->getType ()->lookThroughSingleOptionalType ();
389
390
case Kind::Function: {
390
391
auto *AFD = getFunction ();
391
392
if (AFD->hasImplicitSelfDecl () && AppliedSelf)
392
393
return AFD->getMethodInterfaceType ();
393
394
return AFD->getInterfaceType ();
394
395
}
395
396
case Kind::Closure: return getClosure ()->getType ();
396
- case Kind::Parameter: return getParameter ()->getInterfaceType ();
397
+ case Kind::Parameter:
398
+ return getParameter ()->getInterfaceType ()
399
+ ->lookThroughSingleOptionalType ();
397
400
}
398
401
llvm_unreachable (" bad kind" );
399
402
}
@@ -1831,6 +1834,11 @@ class ApplyClassifier {
1831
1834
return ;
1832
1835
}
1833
1836
1837
+ // Can end up with an optional type when dynamically dispatching to
1838
+ // @objc.
1839
+ if (auto optFnType = fnInterfaceType->getOptionalObjectType ())
1840
+ fnInterfaceType = optFnType;
1841
+
1834
1842
// Use the most significant result from the arguments.
1835
1843
FunctionType *fnSubstType = nullptr ;
1836
1844
if (auto *fnGenericType = fnInterfaceType->getAs <GenericFunctionType>())
You can’t perform that action at this time.
0 commit comments