File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -2597,14 +2597,26 @@ class SubstFunctionTypePatternVisitor
2597
2597
if (yieldType) {
2598
2598
substYieldType = visit (yieldType, yieldPattern);
2599
2599
}
2600
-
2600
+
2601
+ CanType newErrorType;
2602
+ if (auto optErrorType = func->getEffectiveThrownErrorType ()) {
2603
+ newErrorType = visit ((*optErrorType)->getCanonicalType (),
2604
+ pattern.getFunctionThrownErrorType ());
2605
+ }
2606
+
2601
2607
auto newResultTy = visit (func.getResult (),
2602
2608
pattern.getFunctionResultType ());
2603
2609
2604
2610
llvm::Optional<FunctionType::ExtInfo> extInfo;
2605
2611
if (func->hasExtInfo ())
2606
2612
extInfo = func->getExtInfo ();
2607
-
2613
+
2614
+ if (newErrorType) {
2615
+ if (!extInfo)
2616
+ extInfo = FunctionType::ExtInfo ();
2617
+ extInfo = extInfo->withThrows (true , newErrorType);
2618
+ }
2619
+
2608
2620
return CanFunctionType::get (FunctionType::CanParamArrayRef (newParams),
2609
2621
newResultTy, extInfo);
2610
2622
}
You can’t perform that action at this time.
0 commit comments