Skip to content

Fix compile errors for Swift 6 language mode - #230

Merged
natecook1000 merged 2 commits into
apple:mainfrom
b1ackturtle:fix-swift6-compile-errors
Jan 14, 2025
Merged

natecook1000 merged 2 commits into
apple:mainfrom
b1ackturtle:fix-swift6-compile-errors

Conversation

@b1ackturtle

Copy link
Copy Markdown
Contributor

This PR fixes code that caused compile errors when enabling the Swift 6 language mode.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

@natecook1000 natecook1000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks so much for this, @b1ackturtle — just one set of changes and we can merge this.

elements: S,
expectedValue: Int,
file: StaticString = #file, line: UInt = #line
file: StaticString = #filePath, line: UInt = #line

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we resolve these warnings in this way instead? The #filePath attribute was introduced in Swift 5.8, but we're going to support back to Swift 5.7 in the next release of this package.

Suggested change
file: StaticString = #filePath, line: UInt = #line
file: StaticString = (#file), line: UInt = #line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review. I have updated my code based on your suggestion.

@b1ackturtle
b1ackturtle force-pushed the fix-swift6-compile-errors branch from b1cf3c3 to 135802f Compare August 23, 2024 14:11
@glessard

Copy link
Copy Markdown
Contributor

@swift-ci please test


final class GroupedTests: XCTestCase {
private class SampleError: Error {}
private final class SampleError: Error {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you please explain, why do we need this final keyword here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was added to resolve the following error:
Non-final class 'SampleError' cannot conform to 'Sendable'; use @unchecked Sendable

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for explanation. Can you please also update you branch with base branch?

@b1ackturtle
b1ackturtle force-pushed the fix-swift6-compile-errors branch from 135802f to c378d3c Compare October 7, 2024 10:49
@natecook1000

Copy link
Copy Markdown
Member

@swift-ci Please test

@natecook1000

Copy link
Copy Markdown
Member

@swift-ci Please test

@natecook1000
natecook1000 merged commit cdc909b into apple:main Jan 14, 2025
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.

5 participants