Skip to content

Commit c0359f0

Browse files
committed
---
yaml --- r: 348115 b: refs/heads/master c: 911d205 h: refs/heads/master i: 348113: 83ec6ff 348111: 88d91f3
1 parent b0335a1 commit c0359f0

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1bf7d48111a10a57c8344281df58346bb1e61bd5
2+
refs/heads/master: 911d2056285fb34d02906bed8bcb2d69e28f408a
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/include/swift/AST/DiagnosticsSema.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3985,6 +3985,11 @@ ERROR(dynamic_with_transparent,none,
39853985
"a declaration cannot be both '@_tranparent' and 'dynamic'",
39863986
())
39873987

3988+
ERROR(dynamic_and_library_evolution_not_supported,none,
3989+
"marking non-'@objc' Swift declaration 'dynamic' in library evolution mode is not supported",
3990+
())
3991+
3992+
39883993
//------------------------------------------------------------------------------
39893994
// MARK: @_dynamicReplacement(for:)
39903995
//------------------------------------------------------------------------------

trunk/lib/Sema/TypeCheckAttr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,12 @@ void AttributeEarlyChecker::visitDynamicAttr(DynamicAttr *attr) {
333333
// Members cannot be both dynamic and @_transparent.
334334
if (D->getAttrs().hasAttribute<TransparentAttr>())
335335
diagnoseAndRemoveAttr(attr, diag::dynamic_with_transparent);
336+
if (!D->getAttrs().hasAttribute<ObjCAttr>() &&
337+
D->getModuleContext()->isResilient())
338+
diagnoseAndRemoveAttr(attr,
339+
diag::dynamic_and_library_evolution_not_supported);
336340
}
337341

338-
339342
void AttributeEarlyChecker::visitIBActionAttr(IBActionAttr *attr) {
340343
// Only instance methods can be IBActions.
341344
const FuncDecl *FD = cast<FuncDecl>(D);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-typecheck-verify-swift -swift-version 5 -enable-objc-interop -enable-library-evolution -I %t
3+
4+
struct Container {
5+
dynamic var property: Int { return 1 } // expected-error{{marking non-'@objc' Swift declaration 'dynamic' in library evolution mode is not supported}}
6+
dynamic func foo() {} // expected-error{{marking non-'@objc' Swift declaration 'dynamic' in library evolution mode is not supported}}
7+
}
8+
9+
class AClass {
10+
dynamic var property: Int { return 1 } // expected-error{{marking non-'@objc' Swift declaration 'dynamic' in library evolution mode is not supported}}
11+
dynamic func foo() {} // expected-error{{marking non-'@objc' Swift declaration 'dynamic' in library evolution mode is not supported}}
12+
13+
@objc dynamic func allowed() {}
14+
15+
16+
@objc dynamic var allowedProperty : Int { return 1}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-typecheck-verify-swift -swift-version 5 -enable-objc-interop -enable-library-evolution -enable-implicit-dynamic -I %t
3+
4+
struct Container {
5+
var property: Int { return 1 }
6+
func foo() {}
7+
}
8+
9+
class AClass {
10+
var property: Int { return 1 }
11+
func foo() {}
12+
13+
@objc dynamic func allowed() {}
14+
15+
16+
@objc dynamic var allowedProperty : Int { return 1}
17+
}

0 commit comments

Comments
 (0)