Skip to content

Commit ddef726

Browse files
authored
Merge pull request #76274 from tshortli/module-alias-foundation
ModuleInterface: Don't alias Foundation module in swiftinterfaces
2 parents fc52f2f + a0a4ac3 commit ddef726

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lib/Frontend/ModuleInterfaceSupport.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ static void printToolVersionAndFlagsComment(raw_ostream &out,
9797
importedName == BUILTIN_NAME)
9898
continue;
9999

100+
// Aliasing Foundation confuses the typechecker (rdar://128897610).
101+
if (importedName == "Foundation")
102+
continue;
103+
100104
if (AliasModuleNamesTargets.insert(importedName).second) {
101105
out << " -module-alias " << MODULE_DISAMBIGUATING_PREFIX <<
102106
importedName << "=" << importedName;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -alias-module-names-in-module-interface -module-name Library
3+
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -module-name Library
4+
// RUN: %FileCheck %s < %t/Library.swiftinterface
5+
6+
// REQUIRES: objc_interop
7+
8+
// CHECK: import Foundation
9+
import Foundation
10+
11+
public class C: NSObject {
12+
// CHECK: @objc override dynamic public func observeValue(forKeyPath keyPath: Swift.String?, of object: Any?, change: [Foundation.NSKeyValueChangeKey : Any]?, context: Swift.UnsafeMutableRawPointer?)
13+
public override func observeValue(
14+
forKeyPath keyPath: String?,
15+
of object: Any?,
16+
change: [NSKeyValueChangeKey : Any]?,
17+
context: UnsafeMutableRawPointer?
18+
){}
19+
}

0 commit comments

Comments
 (0)