-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.3] Revise #file changes from SE-0274 #32811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
beccadax
merged 10 commits into
swiftlang:release/5.3
from
beccadax:magical-and-evolutionary-5.3
Jul 17, 2020
Merged
[5.3] Revise #file changes from SE-0274 #32811
beccadax
merged 10 commits into
swiftlang:release/5.3
from
beccadax:magical-and-evolutionary-5.3
Jul 17, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The meaning of EnableConcisePoundFile is going to shift slightly, so it makes sense to always include #filePath in completions. Also, @rintaro confirmed that this should be using KeywordKind::pound_filePath, not KeywordKind::pound_file.
Extracts the list of magic identifier literal kinds into a separate file and updates a lot of code to use macro metaprogramming instead of naming half a dozen cases manually. This is a complicated change, but it should be NFC.
Doing this NFC renaming first helps clarify the functional changes to come. # Conflicts: # lib/SILGen/SILGenConvert.cpp
…and modify resolveFileIDConflicts() to diagnose any such violations instead of asserting. Swift does not allow any two files in the same module to have the same filename, even if they are in different directories. However, this is enforced in the driver, so tests that invoke the frontend directly can violate it. Turns out that a couple of those snuck into the test suite at various points. This commit updates those tests. It also causes the frontend to diagnose the duplicate filename error just as the driver would have, which should help us understand what happened more easily if this crops up again in the future. NFC, since invoking the frontend directly is unsupported.
This temporarily breaks -enable-experimental-concise-pound-file. fixup adding #fileID # Conflicts: # lib/SILGen/SILGenConvert.cpp
Such as force unwraps, as! casts, etc. # Conflicts: # lib/SILGen/SILGenConvert.cpp
In -swift-version 5 and earlier, #file will continue to be a synonym for #filePath; in a future -swift-version (“Swift 6 mode”), it will become a synonym for #fileID. #file in libraries will be interpreted according to the language mode the library was compiled in, not the language mode its client uses. Implement this behavior, tied to a frontend flag instead of a language version. We do so by splitting the old `MagicIdentifierLiteralExprKind::File` into two separate cases, `FileIDSpelledAsFile` and `FilePathSpelledAsFile`, and propagating this distinction throughout the AST. This seems cleaner than looking up the setting for the module the declaration belongs to every time we see `File`. This doesn’t handle module interfaces yet; we’ll take care of those in a separate commit. # Conflicts: # lib/Serialization/ModuleFormat.h
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.
This change makes: * #file compatible with #fileID in “Swift 6 mode” * #file compatible with #filePath and #fileID in Swift 5 mode * #file in Swift 5 mode code compatible with #file in “Swift 6 mode” code This should keep anyone from seeing XCTAssert-wrapping noise until they adopt “Swift 6 mode” (whatever version that ends up actually being).
We ultimately want to explicitly change standard library uses of #file to #fileID, but once we do, previous compilers won’t be able to build the standard library. So instead, we will temporarily build the standard library with -enable-experimental-concise-pound-file, which should have the same effect, but will back-deploy to compilers going back several months.
With swiftlang/swift-syntax#227 @swift-ci please test |
With swiftlang/swift-syntax#227 @swift-ci please test |
DougGregor
approved these changes
Jul 17, 2020
benrimmington
added a commit
to swiftlang/swift-evolution
that referenced
this pull request
Jul 18, 2020
beccadax
added a commit
to beccadax/swift
that referenced
this pull request
Aug 11, 2020
This tweaks the implementation of SE-0285 to preserve backwards compatibility with the previous module serialization format. Existing default arguments all keep their previous values when serialized; #fileID and Swift 6 #file are given previously unused values. Fixes rdar://66810027.
tkremenek
added a commit
that referenced
this pull request
Aug 14, 2020
[NFC] Rework serialization changes in #32811
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🍒 release cherry pick
Flag: Release branch cherry picks
swift evolution approved
Flag → feature: A feature that was approved through the Swift evolution process
swift 5.3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-picks #32700 to release/5.3.
Fixes rdar://65114002 and SR-12936.