Skip to content

Commit f8ca397

Browse files
authored
Merge pull request #77526 from hamishknight/remove-dead-func
[Sema] NFC: Remove `diagnoseMoveOnlyPatternMatchSubject`
2 parents fab09c5 + 26b827d commit f8ca397

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4425,30 +4425,9 @@ void swift::performAbstractFuncDeclDiagnostics(AbstractFunctionDecl *AFD) {
44254425
}
44264426
}
44274427

4428-
static void
4429-
diagnoseMoveOnlyPatternMatchSubject(ASTContext &C,
4430-
const DeclContext *DC,
4431-
Expr *subjectExpr) {
4432-
// For now, move-only types must use the `consume` operator to be
4433-
// pattern matched. Pattern matching is only implemented as a consuming
4434-
// operation today, but we don't want to be stuck with that as the default
4435-
// in the fullness of time when we get borrowing pattern matching later.
4436-
4437-
// Don't bother if the subject wasn't given a valid type, or is a copyable
4438-
// type.
4439-
auto subjectType = subjectExpr->getType();
4440-
if (!subjectType
4441-
|| subjectType->hasError()
4442-
|| !subjectType->isNoncopyable()) {
4443-
return;
4444-
}
4445-
}
4446-
44474428
// Perform MiscDiagnostics on Switch Statements.
44484429
static void checkSwitch(ASTContext &ctx, const SwitchStmt *stmt,
44494430
DeclContext *DC) {
4450-
diagnoseMoveOnlyPatternMatchSubject(ctx, DC, stmt->getSubjectExpr());
4451-
44524431
// We want to warn about "case .Foo, .Bar where 1 != 100:" since the where
44534432
// clause only applies to the second case, and this is surprising.
44544433
for (auto cs : stmt->getCases()) {
@@ -5206,9 +5185,7 @@ static void checkLabeledStmtConditions(ASTContext &ctx,
52065185

52075186
switch (elt.getKind()) {
52085187
case StmtConditionElement::CK_Boolean:
5209-
break;
52105188
case StmtConditionElement::CK_PatternBinding:
5211-
diagnoseMoveOnlyPatternMatchSubject(ctx, DC, elt.getInitializer());
52125189
break;
52135190
case StmtConditionElement::CK_Availability: {
52145191
auto info = elt.getAvailability();

0 commit comments

Comments
 (0)