Skip to content

Commit 90fe435

Browse files
committed
Don't constrain to swift-version 5
1 parent 1b863d6 commit 90fe435

File tree

3 files changed

+1
-16
lines changed

3 files changed

+1
-16
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3874,9 +3874,6 @@ ERROR(borrowed_on_objc_protocol_requirement,none,
38743874

38753875
ERROR(dynamic_not_in_class,none,
38763876
"only members of classes may be dynamic", ())
3877-
ERROR(dynamic_with_final,none,
3878-
"a declaration cannot be both 'final' and 'dynamic'",
3879-
())
38803877
ERROR(dynamic_with_nonobjc,none,
38813878
"a declaration cannot be both '@nonobjc' and 'dynamic'",
38823879
())

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,6 @@ void AttributeEarlyChecker::visitMutationAttr(DeclAttribute *attr) {
323323
}
324324

325325
void AttributeEarlyChecker::visitDynamicAttr(DynamicAttr *attr) {
326-
// Members cannot be both dynamic and final.
327-
// We do allow dynamic final members for dynamic replacement in
328-
// swift-version 5.
329-
if (D->getAttrs().hasAttribute<FinalAttr>() &&
330-
!D->getASTContext().LangOpts.isSwiftVersionAtLeast(5))
331-
diagnoseAndRemoveAttr(attr, diag::dynamic_with_final);
332-
333326
// Members cannot be both dynamic and @nonobjc.
334327
if (D->getAttrs().hasAttribute<NonObjCAttr>())
335328
diagnoseAndRemoveAttr(attr, diag::dynamic_with_nonobjc);
@@ -2593,11 +2586,6 @@ void TypeChecker::addImplicitDynamicAttribute(Decl *D) {
25932586
isa<AccessorDecl>(D))
25942587
return;
25952588

2596-
// Don't add implicit dynamic to final functions before swift-version 5.
2597-
if (D->getAttrs().hasAttribute<FinalAttr>() &&
2598-
!D->getASTContext().LangOpts.isSwiftVersionAtLeast(5))
2599-
return;
2600-
26012589
if (D->getAttrs().hasAttribute<NonObjCAttr>() ||
26022590
D->getAttrs().hasAttribute<TransparentAttr>() ||
26032591
D->getAttrs().hasAttribute<InlinableAttr>())

test/attr/attr_dynamic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Foo {
3434

3535
func notDynamic() {}
3636

37-
@objc final dynamic func indecisive() {} // expected-error{{a declaration cannot be both 'final' and 'dynamic'}} {{15-23=}}
37+
@objc final dynamic func indecisive() {}
3838
}
3939

4040
struct Bar {

0 commit comments

Comments
 (0)