mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Differentiate between Swift 5 and “Swift 6” #file
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.
This commit is contained in:
@@ -1121,9 +1121,10 @@ static uint8_t getRawStableDefaultArgumentKind(swift::DefaultArgumentKind kind)
|
||||
CASE(Normal)
|
||||
CASE(Inherited)
|
||||
CASE(Column)
|
||||
CASE(File)
|
||||
CASE(FileID)
|
||||
CASE(FilePath)
|
||||
CASE(FileIDSpelledAsFile)
|
||||
CASE(FilePathSpelledAsFile)
|
||||
CASE(Line)
|
||||
CASE(Function)
|
||||
CASE(DSOHandle)
|
||||
|
||||
Reference in New Issue
Block a user