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 }
@@ -1827,6 +1830,11 @@ class ApplyClassifier {
18271830 return ;
18281831 }
18291832
1833+ // Can end up with an optional type when dynamically dispatching to
1834+ // @objc.
1835+ if (auto optFnType = fnInterfaceType->getOptionalObjectType ())
1836+ fnInterfaceType = optFnType;
1837+
18301838 // Use the most significant result from the arguments.
18311839 FunctionType *fnSubstType = nullptr ;
18321840 if (auto *fnGenericType = fnInterfaceType->getAs <GenericFunctionType>())
You can’t perform that action at this time.
0 commit comments