Skip to content

Conversation

@tshortli
Copy link
Contributor

@tshortli tshortli commented Sep 11, 2025

If a .swiftinterface file does not include an explicit -language-mode option (or its predecessor -swift-version) and needs to be built as a dependency of a client compilation, then the invocation to build the module from interface would end up inheriting the language mode that the client code is built with. This can result in spurious type checking diagnostics or even mis-compilation. To ensure that a module interface is always built using the language mode that its source code was originally built with, require an explicit -language-mode option when emitting swiftinterface files.

Resolves rdar://145168219.

@tshortli tshortli requested review from beccadax and xymus September 11, 2025 23:41
@tshortli tshortli requested a review from artemcm as a code owner September 11, 2025 23:41
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli enabled auto-merge September 12, 2025 00:05
@tshortli
Copy link
Contributor Author

@swift-ci please test Linux

@tshortli tshortli changed the title Frontend: Require -swift-version option when emitting swiftinterfaces Frontend: Require -language-mode option when emitting swiftinterfaces Sep 12, 2025
@tshortli tshortli force-pushed the require-swift-version-in-module-interfaces branch 2 times, most recently from 5215551 to e588edd Compare September 12, 2025 02:27
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli force-pushed the require-swift-version-in-module-interfaces branch from e588edd to 0ecb87e Compare September 12, 2025 06:11
@tshortli
Copy link
Contributor Author

@swift-ci please test

If a `.swiftinterface` file does not include an explicit `-language-mode`
option (or its predecessor `swift-version`) and needs to be built as a
dependency of a client compilation, then the invocation to build the module
from interface would end up inheriting the language mode that the client code
is built with. This can result in spurious type checking diagnostics or even
mis-compilation. To ensure that a module interface is always built using the
language mode that its source code was originally built with, require an
explicit `-language-mode` option when emitting swiftinterface files.

Resolves rdar://145168219.
@tshortli tshortli force-pushed the require-swift-version-in-module-interfaces branch from 0ecb87e to 13d61b0 Compare September 12, 2025 16:10
@tshortli
Copy link
Contributor Author

swiftlang/llvm-project#11391

@swift-ci please test

tshortli added a commit to tshortli/swift-driver that referenced this pull request Sep 12, 2025
swiftlang/swift#84244 introduces the requirement that
`swift-frontend` jobs emitting a swiftinterface must explicitly specify either
`-language-mode` or `-swift-version` to avoid mis-compilation of the interface.
Add the necessary arguments to various tests that form their own
`swift-frontend` invocations.
tshortli added a commit to tshortli/swift-driver that referenced this pull request Sep 13, 2025
swiftlang/swift#84244 introduces the requirement that
`swift-frontend` jobs emitting a swiftinterface must explicitly specify either
`-language-mode` or `-swift-version` to avoid mis-compilation of the interface.
Add the necessary arguments to various tests that form their own
`swift-frontend` invocations.
@tshortli
Copy link
Contributor Author

@tshortli
Copy link
Contributor Author

swiftlang/llvm-project#11391
swiftlang/swift-driver#1985

@swift-ci please build toolchain macOS platform

@tshortli
Copy link
Contributor Author

swiftlang/swift-driver#1986

@swift-ci please test macOS

@tshortli tshortli merged commit cfe9f90 into swiftlang:main Sep 15, 2025
6 checks passed
@tshortli tshortli deleted the require-swift-version-in-module-interfaces branch September 15, 2025 17:08
tshortli added a commit to tshortli/swift that referenced this pull request Sep 15, 2025
…uage_mode'.

Downgrade the new error in swiftlang#84244 to a
warning.

The PR smoke test build is using a different build system that is failing to
pass `-swift-version` arguments when building various stdlib modules. That
needs to be fixed, but for now we also need to unblock CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants