Skip to content

Commit 3fb34c4

Browse files
author
Harlan Haskins
committed
[Sema] Bail early in exportability checker if there's no extended type
I'm unable to reproduce this or figure out exactly when it happens, but in some circumstances we might form an extension that is marked valid but that doesn't have an extended nominal type. Add an assertion here, but don't crash if we see one of these. rdar://50401284
1 parent 1e36059 commit 3fb34c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Sema/TypeCheckAccess.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,12 @@ class ExportabilityChecker : public DeclVisitor<ExportabilityChecker> {
18731873
}
18741874

18751875
void visitExtensionDecl(ExtensionDecl *ED) {
1876-
if (shouldSkipChecking(ED->getExtendedNominal()))
1876+
auto extendedType = ED->getExtendedNominal();
1877+
// TODO: Sometimes we have an extension that is marked valid but has no
1878+
// extended type. Assert, just in case we see it while testing, but
1879+
// don't crash. rdar://50401284
1880+
assert(extendedType && "valid extension with no extended type?");
1881+
if (!extendedType || shouldSkipChecking(extendedType))
18771882
return;
18781883

18791884
// FIXME: We should allow conforming to implementation-only protocols,

0 commit comments

Comments
 (0)