Skip to content

Duplicate diagnostics being output in Swift 6 #1669

Open
@award999

Description

@award999

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions