Skip to content

Commit cad5f62

Browse files
committed
Make swiftinterfaces propagate #file behavior
Add -experimental-enable-concise-pound-file to the list of flags preserved by module interfaces, so that when we rebuild an interface, it comes out the same way as the original file.
1 parent 9a838bb commit cad5f62

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

include/swift/Option/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def enable_experimental_additive_arithmetic_derivation :
543543

544544
def enable_experimental_concise_pound_file : Flag<["-"],
545545
"enable-experimental-concise-pound-file">,
546-
Flags<[FrontendOption]>,
546+
Flags<[FrontendOption, ModuleInterfaceOption]>,
547547
HelpText<"Enable experimental concise '#file' identifier">;
548548

549549
def enable_direct_intramodule_dependencies : Flag<["-"],

test/SILGen/magic_identifier_file.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
// Test in "Swift 6" mode:
1313
// RUN: %target-swift-emit-silgen -I %t -enable-experimental-concise-pound-file -module-name Foo %/s | %FileCheck --check-prefixes=BOTH,CONCISE %s
1414

15+
// Remove compiled modules so we test against interfaces:
16+
// RUN: rm %t/MagicIdentifierFileSwift5.swiftmodule %t/MagicIdentifierFileSwift6.swiftmodule
17+
18+
// Test in Swift 5 mode:
19+
// RUN: %target-swift-emit-silgen -I %t -module-name Foo %/s | %FileCheck --check-prefixes=BOTH,ABSOLUTE %s
20+
21+
// Test in "Swift 6" mode:
22+
// RUN: %target-swift-emit-silgen -I %t -enable-experimental-concise-pound-file -module-name Foo %/s | %FileCheck --check-prefixes=BOTH,CONCISE %s
23+
1524
import MagicIdentifierFileSwift5
1625
import MagicIdentifierFileSwift6
1726

0 commit comments

Comments
 (0)