Skip to content

Commit ca66379

Browse files
author
Brian King
committed
Only emit compatibility warning in Swift 3 mode
1 parent 3b89390 commit ca66379

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ class AttributeEarlyChecker : public AttributeVisitor<AttributeEarlyChecker> {
186186
// 'final' only makes sense in the context of a class declaration.
187187
// Reject it on global functions, protocols, structs, enums, etc.
188188
if (!D->getDeclContext()->getAsClassOrClassExtensionContext()) {
189-
if (D->getDeclContext()->getAsProtocolExtensionContext())
189+
if (TC.Context.isSwiftVersion3() &&
190+
D->getDeclContext()->getAsProtocolExtensionContext())
190191
TC.diagnose(attr->getLocation(),
191192
diag::protocol_extension_cannot_be_final)
192193
.fixItRemove(attr->getRange());

0 commit comments

Comments
 (0)