Skip to content

Commit c515b53

Browse files
author
Itai Ferber
committed
Remove unnecessary enum case check
1 parent 22185d2 commit c515b53

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/AST/Decl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,9 +2110,9 @@ bool NominalTypeDecl::derivesProtocolConformance(ProtocolDecl *protocol) const {
21102110
return nominal == C.getStringDecl() || nominal == C.getIntDecl();
21112111
}
21122112

2113-
// Empty enums are allowed to conform as well.
2114-
return enumDecl->getAllElements().empty() ||
2115-
enumDecl->hasOnlyCasesWithoutAssociatedValues();
2113+
// hasOnlyCasesWithoutAssociatedValues will return true for empty enums;
2114+
// empty enumas are allowed to conform as well.
2115+
return enumDecl->hasOnlyCasesWithoutAssociatedValues();
21162116
}
21172117

21182118
default:

0 commit comments

Comments
 (0)