Skip to content

Commit 4c45a4d

Browse files
committed
AST: Fix the formatting and content of TypeRefinementContext verifier errors.
1 parent e4d625c commit 4c45a4d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/AST/TypeRefinementContext.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ verificationError(ASTContext &ctx, llvm::StringRef msg,
526526
auto context = std::get<1>(pair);
527527
llvm::errs() << label << ":\n";
528528
context->print(llvm::errs(), ctx.SourceMgr);
529+
llvm::errs() << "\n";
529530
}
530531
abort();
531532
}
@@ -570,18 +571,20 @@ void TypeRefinementContext::verify(const TypeRefinementContext *parent,
570571
if (!SrcRange.isValid())
571572
verificationError(ctx, "invalid source range", {{"node", this}});
572573

574+
// Child nodes must be contained by their parents in all dimensions (source
575+
// range, introduction version, etc).
573576
if (getReason() != Reason::Root) {
574577
auto parentRange = parent->SrcRange;
575578
if (parentRange.isValid() &&
576579
!(srcMgr.isAtOrBefore(parentRange.Start, SrcRange.Start) &&
577580
srcMgr.isAtOrBefore(SrcRange.End, parentRange.End)))
578581
verificationError(ctx, "child source range not contained",
579-
{{"child", this}, {"parent", this}});
582+
{{"child", this}, {"parent", parent}});
580583
}
581584

582585
if (!AvailabilityInfo.isContainedIn(parent->AvailabilityInfo))
583586
verificationError(ctx, "child availability range not contained",
584-
{{"child", this}, {"parent", this}});
587+
{{"child", this}, {"parent", parent}});
585588
}
586589

587590
void TypeRefinementContext::verify(ASTContext &ctx) {

0 commit comments

Comments
 (0)