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