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

Fix compile errors for Swift 6 language mode #230

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

b1ackturtle
Copy link

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

Copy link
Member

@natecook1000 natecook1000 left a comment

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.

@@ -16,7 +16,7 @@ func validateRandomSamples<S: Sequence>(
_ samples: [Int: Int],
elements: S,
expectedValue: Int,
file: StaticString = #file, line: UInt = #line
file: StaticString = #filePath, line: UInt = #line
Copy link
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
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
Contributor

@swift-ci please test

@@ -13,7 +13,7 @@ import XCTest
import Algorithms

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

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
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

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
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