Skip to content
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

Update for Xcode 15.0.1/Swift 5.9/swift-syntax 509.0.2 #23

Merged
merged 22 commits into from
Nov 27, 2023

Conversation

shingt
Copy link
Collaborator

@shingt shingt commented Nov 24, 2023

Checklist

  • All tests are passed.
  • Added tests.
  • Searched existing issues to make sure not duplicated.
    • Duplicated with this PR, but created this PR since it seems stale.

Motivation and Context

Xcode 15.0.1/Swift 5.9 changes.

Description

SwiftSyntax 509.0.x aligns with Swift 5.9, and so adjusting to it in this PR.
Some notable changes:

  • swift-syntax 509.0.2
    • There are a lot of deprecated interfaces, and this PR adapts to such changes.
    • It no longer requires _InternalSwiftSyntaxParser.dylib
  • swift-format 509.0.0
    • Deleted some deprecated rules such as BlankLineBetweenMembers.
  • First support for actor syntax. (as classOrActorKeyword is gone.)

For concrete changes, let me add inline comments.

Related Issue

Impact on Existing Code

@@ -214,6 +214,18 @@ final class DefaultAccessLevelRuleTests: XCTestCase {
)
}

func testClassOpenNotTriggered() throws {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to add this test if it's ok.
(I forgot to replace openKeyward originally, producing the wrong output like open open class Class for this pattern.)

Comment on lines -10 to -13
USE_SWIFT_STATIC_STDLIB := $(shell test -d $$(dirname $$(xcrun --find swift))/../lib/swift_static/macosx && echo use_swift_static_stdlib_flag)
ifeq ($(USE_SWIFT_STATIC_STDLIB), use_swift_static_stdlib_flag)
SWIFT_BUILD_FLAGS += -Xswiftc -static-stdlib
endif
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot pass -static-stdlib under the Darwin env anymore.
Rev: swiftlang/swift-driver#184

visitChildren: nil
)
}

public override func visit(_ node: VariableDeclSyntax) -> DeclSyntax {
visit(
node,
getDeclKeyword: { $0.letOrVarKeyword },
getDeclKeyword: { $0.bindingSpecifier },
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit unintuitive (for me), but swiftlang/swift-syntax#1354

storedProperties.indices.map { index in
let property = storedProperties[index]
let isLast = index == storedProperties.index(before: storedProperties.endIndex)
return SyntaxFactory.makeFunctionParameter(
attributes: nil,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Removing default value arguments (in the entire this PR).

@@ -7,7 +7,7 @@ public extension Indent {
return .spaces(spaces)

case .tab:
return .tabs(1)
return .tab
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Replacing with shorter trivia syntaxes like .tab / .space / etc. in this PR.

)
}

public override func visit(_ node: ActorDeclSyntax) -> DeclSyntax {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding actor support as classOrActorKeyword is gone.

)
}

func testActor() throws {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically same as struct tests.

@shingt shingt marked this pull request as ready for review November 24, 2023 09:52
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed deprecated rules.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from ModifierListSyntaxExtensions. (As ModifierListSyntax is deprecated.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goes to TokenSyntaxExtensions (removing some unnecessary signatures).

@shingt shingt requested a review from ra1028 November 24, 2023 09:54
Copy link
Owner

@ra1028 ra1028 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ra1028 ra1028 merged commit f80f2e5 into ra1028:master Nov 27, 2023
2 checks passed
@ra1028 ra1028 mentioned this pull request Nov 27, 2023
3 tasks
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.

2 participants