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

Duplicate diagnostics being output in Swift 6 #1669

Open
award999 opened this issue May 29, 2024 · 2 comments
Open

Duplicate diagnostics being output in Swift 6 #1669

award999 opened this issue May 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@award999
Copy link

Description

With nightly build of swift 6 I keep seeing duplicate error diagnostics getting output. This was showing up intermittently on macOS but is consistent on Linux.

Reproduction

Create a swift executable with "swift package init". Any error should reproduce:

print("Hello, world!")
let f = 1
f = 2

Build and notice the duplicate error diagnostic

$ swift build --build-tests
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/home/vscode/swift-executable/Sources/main.swift:6:1: error: cannot assign to value: 'f' is a 'let' constant
3 | 
4 | print("Hello, world!")
5 | let f = 1
  | - note: change 'let' to 'var' to make it mutable
6 | f = 2
  | - error: cannot assign to value: 'f' is a 'let' constant
7 | 
/home/vscode/swift-executable/Sources/main.swift:6:1: error: cannot assign to value: 'f' is a 'let' constant
3 | 
4 | print("Hello, world!")
5 | let f = 1
  | - note: change 'let' to 'var' to make it mutable
6 | f = 2
  | - error: cannot assign to value: 'f' is a 'let' constant
7 |

Same when using "llvm" format:

$ swift build -Xswiftc -diagnostic-style=llvm
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/home/vscode/swift-executable/Sources/main.swift:6:1: error: cannot assign to value: 'f' is a 'let' constant
f = 2
^
/home/vscode/swift-executable/Sources/main.swift:5:1: note: change 'let' to 'var' to make it mutable
let f = 1
^~~
var
/home/vscode/swift-executable/Sources/main.swift:6:1: error: cannot assign to value: 'f' is a 'let' constant
f = 2
^
/home/vscode/swift-executable/Sources/main.swift:5:1: note: change 'let' to 'var' to make it mutable
let f = 1
^~~
var

Expected behavior

No duplicate diagnostics

Environment

Using the swiftlang/swift:nightly-6.0-jammy docker image
$ swift -version
Swift version 6.0-dev (LLVM 4b0b1f9e1a69523, Swift 91a3abcf816bc36)
Target: aarch64-unknown-linux-gnu

Additional information

No response

@MaxDesiatov
Copy link
Contributor

Also tracked as rdar://131732364.

@MaxDesiatov MaxDesiatov transferred this issue from swiftlang/swift-package-manager Jul 23, 2024
@finagolfin
Copy link
Member

Heh, this issue is being passed around like a hot potato. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants