Skip to content

Commit 0557d39

Browse files
committed
[NFC] Sema: Collapse invalid where clause diagnosis
1 parent 7b787a6 commit 0557d39

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,11 @@ GenericSignatureRequest::evaluate(Evaluator &evaluator,
622622
} else if (const auto *where = GC->getTrailingWhereClause()) {
623623
// If there is no generic context for the where clause to
624624
// rely on, diagnose that now and bail out.
625-
if (GC->getParent()->isModuleScopeContext()) {
625+
if (!GC->isGenericContext()) {
626626
GC->getASTContext().Diags.diagnose(where->getWhereLoc(),
627-
diag::where_nongeneric_toplevel);
628-
return nullptr;
629-
} else if (!GC->isGenericContext()) {
630-
GC->getASTContext().Diags.diagnose(where->getWhereLoc(),
631-
diag::where_nongeneric_ctx);
627+
GC->getParent()->isModuleScopeContext()
628+
? diag::where_nongeneric_toplevel
629+
: diag::where_nongeneric_ctx);
632630
return nullptr;
633631
}
634632

0 commit comments

Comments
 (0)