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

[SR-13475] swift-tools-version comment whitespace handling should be more helpful #55917

Closed
woolsweater opened this issue Aug 29, 2020 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@woolsweater
Copy link

Previous ID SR-13475
Radar rdar://problem/68115907
Original Reporter @woolsweater
Type Bug
Status Closed
Resolution Done
Environment

Swift Package Manager - Swift 5.3.0

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee @WowbaggersLiquidLunch
Priority Medium

md5: fce3f911aee423772a66b24f8aa07b88

Issue Description:

The fix for SR-4134 introduced an error for unrecognized forms of the Package.swift swift-tools-version comment, but the error is generic and unhelpful when the only "misspelling" is whitespace:

/Users/me/some-project: error: the tools version '//swift-tools-version: 5.3' is not valid; consider using '// swift-tools-version:5.3' to specify the current tools version

Or:

/Users/me/some-project: error: the tools version '//swift-tools-version:5.3' is not valid; consider using '// swift-tools-version:5.3' to specify the current tools version

Really the problem here is that the parsing is overly strict with regards to whitespace. Requiring exactly a single space after the slashes and also none after the colon is unnecessarily arcane. The package manager should be able to work with any amount of space between the "tokens" of the comment, something like:

^//\s*swift-tools-version:\s*\d+\.\d+$
@typesanitizer
Copy link

@swift-ci create

@woolsweater
Copy link
Author

This was resolved by the final version of swiftlang/swift-package-manager#2937

Thank you, @WowbaggersLiquidLunch!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

2 participants