Skip to content

Commit 2ede94f

Browse files
authored
Merge pull request #7383 from DougGregor/remove-expand-generic-env
2 parents 5a031d8 + c6cbd13 commit 2ede94f

File tree

3 files changed

+1
-66
lines changed

3 files changed

+1
-66
lines changed

include/swift/AST/ArchetypeBuilder.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,6 @@ class ArchetypeBuilder {
144144
RequirementSource Source,
145145
llvm::SmallPtrSetImpl<ProtocolDecl *> &Visited);
146146

147-
/// "Expand" all of the archetypes in the generic environment.
148-
/// FIXME: This is a hack we need until we're able to lazily create
149-
/// archetypes.
150-
void expandGenericEnvironment(GenericEnvironment *genericEnv);
151-
152147
public:
153148
/// \brief Add a new conformance requirement specifying that the given
154149
/// potential archetypes are equivalent.

lib/AST/ArchetypeBuilder.cpp

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,61 +2601,3 @@ GenericSignature *ArchetypeBuilder::getGenericSignature() {
26012601
auto sig = GenericSignature::get(Impl->GenericParams, requirements);
26022602
return sig;
26032603
}
2604-
2605-
void ArchetypeBuilder::expandGenericEnvironment(GenericEnvironment *env) {
2606-
2607-
assert(Impl->finalized && "Must finalize builder first");
2608-
2609-
// Force the creation of all of the archetypes.
2610-
// FIXME: This isn't a well-formed notion with recursive protocol constraints.
2611-
auto signature = env->getGenericSignature();
2612-
visitPotentialArchetypes([&](PotentialArchetype *pa) {
2613-
if (auto archetype =
2614-
env->mapTypeIntoContext(
2615-
pa->getDependentType(signature->getGenericParams(),
2616-
/*allowUnresolved=*/false),
2617-
getLookupConformanceFn())
2618-
->getAs<ArchetypeType>())
2619-
(void)archetype->getAllNestedTypes();
2620-
});
2621-
2622-
#ifndef NDEBUG
2623-
// FIXME: This property should be maintained when there are errors, too.
2624-
if (!Diags.hadAnyError()) {
2625-
auto genericParams = signature->getGenericParams();
2626-
visitPotentialArchetypes([&](PotentialArchetype *pa) {
2627-
if (pa->isConcreteType()) return;
2628-
2629-
auto depTy = pa->getDependentType(genericParams,
2630-
/*allowUnresolved=*/false);
2631-
auto inContext = env->mapTypeIntoContext(depTy, getLookupConformanceFn());
2632-
2633-
auto repDepTy = pa->getRepresentative()->getDependentType(
2634-
genericParams,
2635-
/*allowUnresolved=*/false);
2636-
auto repInContext =
2637-
env->mapTypeIntoContext(repDepTy, getLookupConformanceFn());
2638-
if (!(inContext->isEqual(repInContext) ||
2639-
inContext->hasError() ||
2640-
repInContext->hasError())) {
2641-
dump(llvm::errs());
2642-
2643-
llvm::errs() << "Dependent type:\n";
2644-
depTy->dump();
2645-
2646-
llvm::errs() << "Dependent type in context:\n";
2647-
inContext->dump();
2648-
2649-
llvm::errs() << "Representative dependent type:\n";
2650-
repDepTy->dump();
2651-
2652-
llvm::errs() << "Representative in context:\n";
2653-
repInContext->dump();
2654-
2655-
llvm_unreachable(
2656-
"Potential archetype mapping differs from representative!");
2657-
}
2658-
});
2659-
}
2660-
#endif
2661-
}

lib/AST/GenericSignature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ GenericSignature::getCanonicalSignature() const {
204204
GenericEnvironment *GenericSignature::createGenericEnvironment(
205205
ModuleDecl &mod) {
206206
auto *builder = getArchetypeBuilder(mod);
207-
auto env = GenericEnvironment::getIncomplete(this, builder);
208-
builder->expandGenericEnvironment(env);
209-
return env;
207+
return GenericEnvironment::getIncomplete(this, builder);
210208
}
211209

212210

0 commit comments

Comments
 (0)