Skip to content

Commit da3c12e

Browse files
authored
Merge pull request swiftlang#72871 from tshortli/extension-import-visibility
stdlib: Adopt `ExtensionImportVisibility` experimental feature
2 parents 7d72a62 + d0571af commit da3c12e

15 files changed

+102
-7
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE(IsolatedAny, true)
367367

368368

369369
// Whether members of extensions respect the enclosing file's imports.
370-
EXPERIMENTAL_FEATURE(ExtensionImportVisibility, true)
370+
EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE(ExtensionImportVisibility, true)
371371

372372
// Alias for IsolatedAny
373373
EXPERIMENTAL_FEATURE(IsolatedAny2, true)

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ function(_compile_swift_files
628628
list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes")
629629
endif()
630630

631+
list(APPEND swift_flags "-enable-experimental-feature" "ExtensionImportVisiblity")
632+
631633
if (SWIFT_STDLIB_ENABLE_STRICT_CONCURRENCY_COMPLETE)
632634
list(APPEND swift_flags "-strict-concurrency=complete")
633635
endif()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@import Foundation;
2+
3+
@interface X
4+
@end
5+
6+
@interface X (A)
7+
- (void)fromA;
8+
@end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@_exported import Categories_A
2+
3+
extension X {
4+
public func fromOverlayForA() {}
5+
@objc public func fromOverlayForAObjC() {}
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import Categories_A;
2+
3+
@interface X (B)
4+
- (void)fromB;
5+
@end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@_exported import Categories_B
2+
3+
extension X {
4+
public func fromOverlayForB() {}
5+
@objc public func fromOverlayForBObjC() {}
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import Categories_A;
2+
3+
@interface X (C)
4+
- (void)fromC;
5+
@end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@_exported import Categories_C
2+
3+
extension X {
4+
public func fromOverlayForC() {}
5+
@objc public func fromOverlayForCObjC() {}
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import Categories_C
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Categories_A {
2+
header "Categories_A.h"
3+
export *
4+
}
5+
6+
module Categories_B {
7+
header "Categories_B.h"
8+
export *
9+
}
10+
11+
module Categories_C {
12+
header "Categories_C.h"
13+
export *
14+
}

0 commit comments

Comments
 (0)