Skip to content

Commit 3b8f3b5

Browse files
committed
Remove a double-checked invariant
Now that isInvalid() is a semantic property, drop the assertion for this invariant in the ASTVerifier. This should also remove the last client that wasn't registering the lazy resolver and expecting to pull any old interface type out, so change a hack to an assertion to hopefully catch future callers before we remove the LazyResolver entirely.
1 parent 8c1bfbe commit 3b8f3b5

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

lib/AST/ASTVerifier.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3639,17 +3639,7 @@ class Verifier : public ASTWalker {
36393639
void checkErrors(Stmt *S) {}
36403640
void checkErrors(Pattern *P) {}
36413641
void checkErrors(Decl *D) {}
3642-
void checkErrors(ValueDecl *D) {
3643-
PrettyStackTraceDecl debugStack("verifying errors", D);
3644-
3645-
if (!D->hasInterfaceType())
3646-
return;
3647-
if (D->getInterfaceType()->hasError() && !D->isInvalid()) {
3648-
Out << "Valid decl has error type!\n";
3649-
D->dump(Out);
3650-
abort();
3651-
}
3652-
}
3642+
void checkErrors(ValueDecl *D) {}
36533643
};
36543644
} // end anonymous namespace
36553645

lib/AST/Decl.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,12 +2885,10 @@ bool ValueDecl::isRecursiveValidation() const {
28852885
Type ValueDecl::getInterfaceType() const {
28862886
auto &ctx = getASTContext();
28872887

2888-
// Our clients that don't register the lazy resolver are relying on the
2889-
// fact that they can't pull an interface type out to avoid doing work.
2890-
// This is a necessary evil until we can wean them off.
2891-
if (!ctx.getLazyResolver()) {
2892-
return TypeAndAccess.getPointer();
2893-
}
2888+
// N.B. This assertion exists to catch new broken callers. It can be removed
2889+
// with the LazyResolver when the time comes.
2890+
assert(ctx.getLazyResolver()
2891+
&& "The lazy resolver must be registered to make semantic queries!");
28942892

28952893
if (auto type =
28962894
evaluateOrDefault(ctx.evaluator,

0 commit comments

Comments
 (0)