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 {
385385
386386 Type getType () const {
387387 switch (getKind ()) {
388- case Kind::Opaque: return getOpaqueFunction ()->getType ();
388+ case Kind::Opaque:
389+ return getOpaqueFunction ()->getType ()->lookThroughSingleOptionalType ();
389390 case Kind::Function: {
390391 auto *AFD = getFunction ();
391392 if (AFD->hasImplicitSelfDecl () && AppliedSelf)
392393 return AFD->getMethodInterfaceType ();
393394 return AFD->getInterfaceType ();
394395 }
395396 case Kind::Closure: return getClosure ()->getType ();
396- case Kind::Parameter: return getParameter ()->getInterfaceType ();
397+ case Kind::Parameter:
398+ return getParameter ()->getInterfaceType ()
399+ ->lookThroughSingleOptionalType ();
397400 }
398401 llvm_unreachable (" bad kind" );
399402 }
@@ -1831,6 +1834,11 @@ class ApplyClassifier {
18311834 return ;
18321835 }
18331836
1837+ // Can end up with an optional type when dynamically dispatching to
1838+ // @objc.
1839+ if (auto optFnType = fnInterfaceType->getOptionalObjectType ())
1840+ fnInterfaceType = optFnType;
1841+
18341842 // Use the most significant result from the arguments.
18351843 FunctionType *fnSubstType = nullptr ;
18361844 if (auto *fnGenericType = fnInterfaceType->getAs <GenericFunctionType>())
You can’t perform that action at this time.
0 commit comments