Skip to content

Failed to produce diagnostic for expression on incorrect type name #82337

Open
@Zim999

Description

@Zim999

Description

The code below generates a "Failed to produce diagnostic for expression" error at the var body line.

The cause is the incorrect use of lowercase foo in the array declaration, and the compiler also generates the valid "Cannot find type 'foo' in scope" error on that line.

However, it should not generate the failed diagnostic message.

The issue can be reproduced by pasting the code into a playground.

Reproduction

import SwiftUI

struct Foo {
}

struct V: View {
    var body: some View {
        let foos: [foo]
    }
}

Expected behavior

The "Failed to produce diagnostic for expression" should not be generated

Environment

swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0

And

swift-driver version: 1.127.4.2 Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907)
Target: arm64-apple-macosx15.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions