You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Package.swift diagnostics line off by 1 for tools versions <= 5.7 (swiftlang#7795)
Fixes issue swiftlang#7688
SwiftPM was implicitly prepending the manifest with 'import Foundation'
for toolchains using Swift toolchain versions 5.7 and under. The
original file itself was never overwritten, thus the diagnostics being
reported would always present on the next line.
This is a quick fix that appends the same line to the end of the
manifest; doing so assures that the intended behaviour doesn't change,
but allows for correct diagnostics to be reported.
### Motivation:
Diagnostics would present on the incorrect line for Package.swift files
using tools version 5.7 and under.
### Modifications:
When evaluating the manifest, a temporary directory copies the contents
of the manifest to a temporary file; rather than prepending the import
to Foundation at the top of the file (causing all lines in the
diagnostic reports to be off by one), append the import to the bottom of
the temporary manifest when dealing with tools versions 5.7 and under.
### Result:
The intended behaviour that requires users to explicitly import
Foundation doesn't change for Swift versions 5.8 and up; diagnostics
reported for Package.swift files for those using swift <= 5.7 will now
show on the correct line.
0 commit comments