Skip to content

Commit 2e0a8a3

Browse files
committed
Fix AST verifier checking of opaque type declarations
1 parent 2bf7f36 commit 2e0a8a3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/AST/ASTVerifier.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,6 +2807,19 @@ class Verifier : public ASTWalker {
28072807

28082808
unsigned currentDepth = DC->getGenericContextDepth();
28092809
if (currentDepth < GTPD->getDepth()) {
2810+
// If this is actually an opaque type's generic parameter, we're okay.
2811+
if (auto value = dyn_cast_or_null<ValueDecl>(DC->getAsDecl())) {
2812+
auto opaqueDecl = dyn_cast<OpaqueTypeDecl>(value);
2813+
if (!opaqueDecl)
2814+
opaqueDecl = value->getOpaqueResultTypeDecl();
2815+
if (opaqueDecl) {
2816+
if (GTPD->getDepth() ==
2817+
opaqueDecl->getOpaqueGenericParams().front()->getDepth()) {
2818+
return;
2819+
}
2820+
}
2821+
}
2822+
28102823
Out << "GenericTypeParamDecl has incorrect depth\n";
28112824
abort();
28122825
}

0 commit comments

Comments
 (0)