|
20 | 20 | #include "swift/SILOptimizer/Differentiation/Common.h"
|
21 | 21 |
|
22 | 22 | #include "swift/AST/AnyFunctionRef.h"
|
23 |
| -#include "swift/AST/GenericSignatureBuilder.h" |
24 | 23 | #include "swift/AST/Requirement.h"
|
25 | 24 | #include "swift/AST/SubstitutionMap.h"
|
| 25 | +#include "swift/AST/TypeCheckRequests.h" |
26 | 26 | #include "swift/SILOptimizer/Utils/SILOptFunctionBuilder.h"
|
27 | 27 | #include "swift/SILOptimizer/Utils/DifferentiationMangler.h"
|
28 | 28 |
|
@@ -53,30 +53,26 @@ CanGenericSignature buildThunkSignature(SILFunction *fn, bool inheritGenericSig,
|
53 | 53 | }
|
54 | 54 |
|
55 | 55 | auto &ctx = fn->getASTContext();
|
56 |
| - GenericSignatureBuilder builder(ctx); |
57 | 56 |
|
58 | 57 | // Add the existing generic signature.
|
| 58 | + GenericSignature baseGenericSig; |
59 | 59 | int depth = 0;
|
60 | 60 | if (inheritGenericSig) {
|
61 |
| - if (auto genericSig = |
62 |
| - fn->getLoweredFunctionType()->getSubstGenericSignature()) { |
63 |
| - builder.addGenericSignature(genericSig); |
64 |
| - depth = genericSig.getGenericParams().back()->getDepth() + 1; |
65 |
| - } |
| 61 | + baseGenericSig = fn->getLoweredFunctionType()->getSubstGenericSignature(); |
| 62 | + if (baseGenericSig) |
| 63 | + depth = baseGenericSig.getGenericParams().back()->getDepth() + 1; |
66 | 64 | }
|
67 | 65 |
|
68 | 66 | // Add a new generic parameter to replace the opened existential.
|
69 | 67 | auto *newGenericParam = GenericTypeParamType::get(depth, 0, ctx);
|
70 |
| - |
71 |
| - builder.addGenericParameter(newGenericParam); |
72 | 68 | Requirement newRequirement(RequirementKind::Conformance, newGenericParam,
|
73 | 69 | openedExistential->getOpenedExistentialType());
|
74 |
| - auto source = |
75 |
| - GenericSignatureBuilder::FloatingRequirementSource::forAbstract(); |
76 |
| - builder.addRequirement(newRequirement, source, nullptr); |
77 | 70 |
|
78 |
| - auto genericSig = std::move(builder).computeGenericSignature( |
79 |
| - /*allowConcreteGenericParams=*/true); |
| 71 | + auto genericSig = evaluateOrDefault( |
| 72 | + ctx.evaluator, |
| 73 | + AbstractGenericSignatureRequest{ |
| 74 | + baseGenericSig.getPointer(), { newGenericParam }, { newRequirement }}, |
| 75 | + GenericSignature()); |
80 | 76 | genericEnv = genericSig.getGenericEnvironment();
|
81 | 77 |
|
82 | 78 | newArchetype =
|
|
0 commit comments