Skip to content

Commit 3e56942

Browse files
committed
Don't require Foundation to bridge 'id' to 'Any'.
It should be possible to make this bridging machinery live in the core runtime, and requiring Foundation for it creates a layering problem for the ObjectiveC module.
1 parent 3acae8f commit 3e56942

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,9 +1213,13 @@ static Type adjustTypeForConcreteImport(ClangImporter::Implementation &impl,
12131213

12141214
// If we have a bridged Objective-C type and we are allowed to
12151215
// bridge, do so.
1216-
if (hint == ImportHint::ObjCBridged && canBridgeTypes(importKind) &&
1217-
(impl.tryLoadFoundationModule() || impl.ImportForwardDeclarations))
1218-
importedType = hint.BridgedType;
1216+
if (hint == ImportHint::ObjCBridged && canBridgeTypes(importKind))
1217+
// id and Any can be bridged without Foundation. There would be
1218+
// bootstrapping issues with the ObjectiveC module otherwise.
1219+
if (hint.BridgedType->isAny()
1220+
|| impl.tryLoadFoundationModule()
1221+
|| impl.ImportForwardDeclarations)
1222+
importedType = hint.BridgedType;
12191223

12201224
if (!importedType)
12211225
return importedType;

0 commit comments

Comments
 (0)