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

swift-format breaks Package.swift by moving an import above the // swift-tools-version: comment #670

Open
dabrahams opened this issue Dec 1, 2023 · 2 comments

Comments

@dabrahams
Copy link
Contributor

dabrahams commented Dec 1, 2023

When I ran swift-format over my project, it turned this

// swift-tools-version:5.7
import Foundation
import PackageDescription

Into this:

import Foundation
// swift-tools-version:5.7
import PackageDescription

Which results in this error:

error: 'hylo': package 'package.swift' is using Swift tools version 3.1.0 which is no longer supported; consider using '// swift-tools-version: 5.9' to specify the current tools version
@allevato
Copy link
Collaborator

allevato commented Dec 6, 2023

I can't imagine why it would think that comment should be glued to the other import, but in addition to fixing that, we should probably carve out a special case for // swift-tools-version:... comments to always keep them at the top of the file.

@ahoppen
Copy link
Contributor

ahoppen commented Apr 23, 2024

Tracked in Apple’s issue tracker as rdar://126948395

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

No branches or pull requests

3 participants