-
Notifications
You must be signed in to change notification settings - Fork 439
[5.10] Cherry-pick multiple PRs to release/5.10
#2346
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
ahoppen
merged 12 commits into
swiftlang:release/5.10
from
ahoppen:ahoppen/5.10/cherry-picks
Nov 29, 2023
Merged
[5.10] Cherry-pick multiple PRs to release/5.10
#2346
ahoppen
merged 12 commits into
swiftlang:release/5.10
from
ahoppen:ahoppen/5.10/cherry-picks
Nov 29, 2023
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
release/5.10
release/5.10
🚥 #2339
bnbarham
approved these changes
Nov 9, 2023
@swift-ci Please test |
…ansion` method When adding a new type that conforms to `MemberMacro`, no `expansion` function is required to be implemented. It’s necessary to do it this way because: - `expansion(of:providingMembersOf:in:)` needs to exist as a protocol requirement to keep Swift 5.9 macros that implement this method compiling - `expansion(of:providingMembersOf:in:)` needs to be defaulted so that macros implementing `expansion(of:providingMembersOf:conformingTo:in:)` don’t need to also provide an implementation for the legacy version that doesn’t have `conformingTo:` - `expansion(of:providingMembersOf:conformingTo:in:)` obviously needs to exist since it’s the new dedicated entry point - `expansion(of:providingMembersOf:conformingTo:in:)` needs to have a default implementation that calls `expansion(of:providingMembersOf:in:)` so that 5.9 macros continue to work - We can’t mark `expansion(of:providingMembersOf:in:)` as deprecated because it’s called by the default implementation of `expansion(of:providingMembersOf:conformingTo:in:)` and we want to keep swift-syntax building without warnings. At the moment, we provide default implementations for both `expansion` functions that call each other, which causes an infinite recursion, that makes it non-obvious to see what’s going wrong. With this change, the default implementation of the legacy `expansion(of:providingMembersOf:in:)` method throws an error saying that you need to implement either of the two expansion methods. That way you get the following behavior: - If you don’t implement either expansion function, the error gets thrown - If a macro implements the legacy `expansion(of:providingMembersOf:in:)` function, then it overrides the throwing version and the macro works. - If a macro implements the new `expansion(of:providingMembersOf:conformingTo:in:)` method, then the compiler calls into that method directly and the legacy `expansion(of:providingMembersOf:in:)` never gets invoked by the compiler. The only possible issue I can think of is if a library is calling `expansion(of:providingMembersOf:in:)` but the macro only implements `expansion(of:providingMembersOf:conformingTo:in:)`. In this case an error would get thrown where it currently isn’t. But since I don’t see any reason why anyone would be calling `expansion(of:providingMembersOf:in:)` directly, I think this is fine.
# Conflicts: # Package.swift
Updates LabeledExprSyntax convenience initializer to include a trailing space trivia after the colon if an argument label is specified. This ensures the rendered description is 'arg: value' instead of 'arg:value'.
When a user is getting the interpolation `os_log` failure message but actually supports parsing invalid source code, offer them an alternative parses the source code without checking for errors.
Otherwise consumers of SwiftSyntax may encounter warnings when compiling with `-strict-concurrency=complete`. For example: ```swift extension DeclModifierListSyntax { var fileprivateModifierIndex: DeclModifierListSyntax.Index? { firstIndex(where: { $0.name.tokenKind == .keyword(.fileprivate) }) } var fileprivateModifier: DeclModifierSyntax? { fileprivateModifierIndex.flatMap { self[$0] } } func replacing(fileprivateModifierIndex: DeclModifierListSyntax.Index) -> DeclModifierListSyntax { let fileprivateModifier = self[fileprivateModifierIndex] return with( \.[fileprivateModifierIndex], fileprivateModifier.with( \.name, .keyword( .private, leadingTrivia: fileprivateModifier.leadingTrivia, trailingTrivia: fileprivateModifier.trailingTrivia ) ) ) } } ``` Produces the following warning: > cannot form key path that captures non-sendable type > 'DeclModifierListSyntax.Index' (aka 'SyntaxChildrenIndex')
commit 4cd9756 Author: Ruslan Alikhamov <[email protected]> Date: Mon Oct 23 22:17:28 2023 +0400 applied swift-format commit dc59e96 Author: Ruslan Alikhamov <[email protected]> Date: Mon Oct 23 22:02:35 2023 +0400 removed redundant variable commit ff95302 Author: Ruslan Alikhamov <[email protected]> Date: Mon Oct 23 22:00:23 2023 +0400 refactored optimization in isValidIdentifierContinuationCodePoint commit 5b94ec9 Author: Ruslan Alikhamov <[email protected]> Date: Mon Oct 23 21:51:48 2023 +0400 fixed a typo; renamed variables commit 7e1f23d Author: Ruslan Alikhamov <[email protected]> Date: Mon Oct 23 21:38:08 2023 +0400 renamed variables in slice(of:) commit 3b9c1f8 Author: Ruslan Alikhamov <[email protected]> Date: Sat Oct 21 19:45:34 2023 +0400 removed redundant newline commit 83ad08c Author: Ruslan Alikhamov <[email protected]> Date: Sat Oct 21 19:02:13 2023 +0400 optimized isSlice(of other: SyntaxText) -> Bool commit f5d0a3a Author: Ruslan Alikhamov <[email protected]> Date: Sat Oct 21 19:02:03 2023 +0400 optimized isValidIdentifierContinuationCodePoint
db08e67
to
58a574e
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
release/5.10
🚥 #2339release/5.10
@swift-ci Please test |
@swift-ci Please test Windows |
@swift-ci Please test Windows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
release/5.10