Skip to content

Commit 59543a1

Browse files
committed
[Type checker] Only "use" bridging conformances when there is a type checker.
Works around rdar://problem/45047761 and rdar://problem/45058722.
1 parent ae5acb9 commit 59543a1

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,8 +1539,11 @@ void markAsObjC(ValueDecl *D, ObjCReason reason,
15391539
}
15401540

15411541
if (!isa<TypeDecl>(D) && !isa<AccessorDecl>(D) && !isa<EnumElementDecl>(D)) {
1542-
useObjectiveCBridgeableConformances(D->getInnermostDeclContext(),
1543-
D->getInterfaceType());
1542+
if (ctx.getLazyResolver()) {
1543+
// Only record conformances when we have a lazy resolver.
1544+
useObjectiveCBridgeableConformances(D->getInnermostDeclContext(),
1545+
D->getInterfaceType());
1546+
}
15441547
}
15451548

15461549
if (auto method = dyn_cast<AbstractFunctionDecl>(D)) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -c -primary-file %s %S/Inputs/0178-rdar-45060773-other.swift -o /dev/null
2+
3+
// REQUIRES: objc_interop
4+
5+
func doit() {
6+
MyCls().something(true)
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Foundation
2+
3+
class MyCls: NSObject {
4+
}
5+
6+
extension MyCls {
7+
@objc func something(_: Bool) {}
8+
}

0 commit comments

Comments
 (0)