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

Tests: Replace uses of deprecated AbsolutePath initializers with throwing variant #1420

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

Conversation

tshortli
Copy link
Contributor

AbsolutePath(_:) has been replaced by a throwing alternative AbsolutePath(validating:). There were dozens of warnings about this emitted when building the driver making it difficult to notice newly introduced warnings.

@tshortli
Copy link
Contributor Author

@swift-ci please test

@artemcm
Copy link
Contributor

artemcm commented Aug 21, 2023

Thanks! I have had this for a while:
#1231
And @compnerd asks we run the tests on Windows before merging. I've been slowly setting up my environment to do so...

@tshortli
Copy link
Contributor Author

tshortli commented Aug 21, 2023

Ah, we can take your PR if you prefer it @artemcm. I'm a bit confused about the request to run on Windows, though. This change should not be able to change anything about the results of the tests on Windows given that the deprecated initializer just calls the throwing intializer and we're removing that indirection. There's zero functional change, just removal of a passthrough layer of indirection:

// MARK: - `AbsolutePath` backwards compatibility, delete after deprecation period.

extension AbsolutePath {
    @available(*, deprecated, message: "use throwing variant instead")
    public init(_ absStr: String) {
        try! self.init(validating: absStr)
    }

    @available(*, deprecated, message: "use throwing variant instead")
    public init(_ str: String, relativeTo basePath: AbsolutePath) {
        try! self.init(validating: str, relativeTo: basePath)
    }
}

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

I agree with @tshortli that this should be okay (but being able to run the Windows tests would be nice). Hopefully we can get there soon!

@tshortli
Copy link
Contributor Author

I'll defer to @artemcm's PR as he's got some different approaches in a few places, I should have checked if there was already something in progress for this.

@tshortli tshortli marked this pull request as draft August 21, 2023 17:24
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.

3 participants