Skip to content

Commit ec82319

Browse files
committed
[codecomplete] Attempt to workaround ArchetypeBuilder crash in non-asserts build
Add a defensive return on null if we're building without assertions. There appears to be a way to trigger this in code-completion, so until we find a reproducer/figure out what's going wrong, try not to crash. Only impacts no-asserts builds. rdar://problem/27615954
1 parent 3cd90a1 commit ec82319

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/AST/ArchetypeBuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,10 @@ void ArchetypeBuilder::addRequirement(const Requirement &req,
14771477
case RequirementKind::Conformance: {
14781478
PotentialArchetype *pa = resolveArchetype(req.getFirstType());
14791479
assert(pa && "Re-introducing invalid requirement");
1480+
// FIXME: defensively return if assertions are disabled until we figure out
1481+
// how this sitatuaion can occur and fix it properly.
1482+
if (!pa)
1483+
return;
14801484

14811485
SmallVector<ProtocolDecl *, 4> conformsTo;
14821486
bool existential = req.getSecondType()->isExistentialType(conformsTo);

0 commit comments

Comments
 (0)