Skip to content

Commit 400d3d1

Browse files
Merge pull request #67272 from nate-chandler/rdar112152116
[Sema] Allow implicit dynamic @nonobjc.
2 parents f7334a1 + 8b662a7 commit 400d3d1

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4622,8 +4622,7 @@ TypeChecker::diagnosticIfDeclCannotBeUnavailable(const Decl *D) {
46224622
}
46234623

46244624
static bool shouldBlockImplicitDynamic(Decl *D) {
4625-
if (D->getAttrs().hasAttribute<NonObjCAttr>() ||
4626-
D->getAttrs().hasAttribute<SILGenNameAttr>() ||
4625+
if (D->getAttrs().hasAttribute<SILGenNameAttr>() ||
46274626
D->getAttrs().hasAttribute<TransparentAttr>() ||
46284627
D->getAttrs().hasAttribute<InlinableAttr>())
46294628
return true;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-implicit-dynamic) | %FileCheck %s
2+
3+
// REQUIRES: executable_test
4+
// REQUIRES: objc_interop
5+
6+
import Foundation
7+
8+
class C : NSObject {
9+
@nonobjc func foo() {
10+
print("original")
11+
}
12+
}
13+
14+
extension C {
15+
@_dynamicReplacement(for: foo()) @nonobjc private func replacement_for_foo() {
16+
print("replacement")
17+
}
18+
}
19+
20+
func doit() {
21+
let c = C()
22+
c.foo()
23+
}
24+
25+
// CHECK: replacement
26+
doit()

0 commit comments

Comments
 (0)