Skip to content

Commit b8ea509

Browse files
committed
Crash in a nice way if the GenericEnv is NULL
On every `pushScope` the generic environment of this scope is appended to `GenericEnv`. If the pushed `DeclContext` isn't generic, `NULL` is pushed leading to a crash only in `DenseMap::find` if some archetypes escaped their generic context.
1 parent 57da0f5 commit b8ea509

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/AST/ASTVerifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ struct ASTNodeBase {};
437437
}
438438

439439
// Otherwise, the archetype needs to be from this scope.
440-
if (GenericEnv.empty()) {
440+
if (GenericEnv.empty() || !GenericEnv.back()) {
441441
Out << "AST verification error: archetype outside of generic "
442442
"context: " << archetype->getString() << "\n";
443443
return true;

0 commit comments

Comments
 (0)