@@ -1725,12 +1725,9 @@ namespace {
1725
1725
= nullptr ,
1726
1726
DifferentiabilityKind diffKind
1727
1727
= DifferentiabilityKind::NonDifferentiable);
1728
- bool
1729
- resolveASTFunctionTypeParams (TupleTypeRepr *inputRepr,
1730
- TypeResolutionOptions options,
1731
- bool requiresMappingOut,
1732
- DifferentiabilityKind diffKind,
1733
- SmallVectorImpl<AnyFunctionType::Param> &ps);
1728
+ SmallVector<AnyFunctionType::Param, 8 > resolveASTFunctionTypeParams (
1729
+ TupleTypeRepr *inputRepr, TypeResolutionOptions options,
1730
+ bool requiresMappingOut, DifferentiabilityKind diffKind);
1734
1731
1735
1732
Type resolveSILFunctionType (FunctionTypeRepr *repr,
1736
1733
TypeResolutionOptions options,
@@ -2453,10 +2450,12 @@ Type TypeResolver::resolveAttributedType(TypeAttributes &attrs,
2453
2450
return ty;
2454
2451
}
2455
2452
2456
- bool TypeResolver::resolveASTFunctionTypeParams (
2457
- TupleTypeRepr *inputRepr, TypeResolutionOptions options,
2458
- bool requiresMappingOut, DifferentiabilityKind diffKind,
2459
- SmallVectorImpl<AnyFunctionType::Param> &elements) {
2453
+ SmallVector<AnyFunctionType::Param, 8 >
2454
+ TypeResolver::resolveASTFunctionTypeParams (TupleTypeRepr *inputRepr,
2455
+ TypeResolutionOptions options,
2456
+ bool requiresMappingOut,
2457
+ DifferentiabilityKind diffKind) {
2458
+ SmallVector<AnyFunctionType::Param, 8 > elements;
2460
2459
elements.reserve (inputRepr->getNumElements ());
2461
2460
2462
2461
auto elementOptions = options.withoutContext (true );
@@ -2477,9 +2476,7 @@ bool TypeResolver::resolveASTFunctionTypeParams(
2477
2476
}
2478
2477
2479
2478
Type ty = resolveType (eltTypeRepr, thisElementOptions);
2480
- if (!ty) return true ;
2481
-
2482
- if (ty->hasError ()) {
2479
+ if (!ty || ty->hasError ()) {
2483
2480
elements.emplace_back (ErrorType::get (Context));
2484
2481
continue ;
2485
2482
}
@@ -2573,7 +2570,7 @@ bool TypeResolver::resolveASTFunctionTypeParams(
2573
2570
}
2574
2571
}
2575
2572
2576
- return false ;
2573
+ return elements ;
2577
2574
}
2578
2575
2579
2576
Type TypeResolver::resolveOpaqueReturnType (TypeRepr *repr,
@@ -2626,18 +2623,16 @@ Type TypeResolver::resolveASTFunctionType(
2626
2623
2627
2624
TypeResolutionOptions options = None;
2628
2625
options |= parentOptions.withoutContext ().getFlags ();
2629
-
2630
- SmallVector<AnyFunctionType::Param, 8 > params;
2631
- if (resolveASTFunctionTypeParams (repr->getArgsTypeRepr (), options,
2632
- repr->getGenericEnvironment () != nullptr ,
2633
- diffKind, params)) {
2634
- return Type ();
2635
- }
2626
+ auto params = resolveASTFunctionTypeParams (
2627
+ repr->getArgsTypeRepr (), options,
2628
+ repr->getGenericEnvironment () != nullptr , diffKind);
2636
2629
2637
2630
auto resultOptions = options.withoutContext ();
2638
2631
resultOptions.setContext (TypeResolverContext::FunctionResult);
2639
2632
Type outputTy = resolveType (repr->getResultTypeRepr (), resultOptions);
2640
- if (!outputTy || outputTy->hasError ()) return outputTy;
2633
+ if (!outputTy || outputTy->hasError ()) {
2634
+ return ErrorType::get (Context);
2635
+ }
2641
2636
2642
2637
// If this is a function type without parens around the parameter list,
2643
2638
// diagnose this and produce a fixit to add them.
0 commit comments