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

[SR-14538] "Failed to produce diagnostic for expression" for SwiftUI View #56890

Closed
swift-ci opened this issue Apr 27, 2021 · 2 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression SwiftUI Flag: Related to (but not an issue with) SwiftUI type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-14538
Radar rdar://problem/77224224
Original Reporter stevex (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 12.5
macOS Big Sur 11.3

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee stevex (JIRA)
Priority Medium

md5: b904439988df94c0286e658cb1a2b960

Issue Description:

The following code produces "Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project" on the LayersView body method. Sample project attached.

struct Actor {
    var imageName: String
}

struct Document {
    var actors = [Actor(imageName: "Bob")]
}

struct LayersView: View {
    var document = Document()
    var body: some View {
        List {
            ForEach(document.actors) { actor in
                Text(actor.imageName)
            }
        }.frame(width: 200)
        .background(Color.gray)
    }
}
@typesanitizer
Copy link

Thanks for the minimal example. 🙂

@swift-ci create

@xedin
Copy link
Member

xedin commented Apr 28, 2021

Looks like this has been fixed on main and compiler would produce a diagnostic here:

error: referencing initializer 'init(_:content:)' on 'ForEach' requires that 'Actor' conform to 'Identifiable'
ForEach(document.actors) { actor in
^
SwiftUI.ForEach:2:11: note: where 'Data.Element' = 'Actor'

stevex (JIRA User) please use the latest snapshot of main branch to verify and close.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added SwiftUI Flag: Related to (but not an issue with) SwiftUI failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression labels Dec 22, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression SwiftUI Flag: Related to (but not an issue with) SwiftUI type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants