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-15593] Failed to produce diagnostic for expression; case let in Swift UI view #57896

Open
swift-ci opened this issue Dec 14, 2021 · 0 comments
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-15593
Radar None
Original Reporter mmulet (JIRA User)
Type Bug
Environment
  • macOS 12.1

  • Mac mini (M1, 2020)

  • Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)

Target: arm64-apple-darwin21.2.0

Additional Detail from JIRA
Votes 0
Component/s Compiler, swift
Labels Bug
Assignee None
Priority Medium

md5: 5e44586f8b9fb1096757f6f3b30bdfb6

Issue Description:

A concise description of the problem:
In a SwiftUI View, when using "if case let" with a case with at least 3 associated values, if you only specify the first two associated values (but not the third) the compiler produces the error: "failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project"

Expected behavior:

The compiler should produce a diagnostic that says "your missing the third associated value" or at the very least produce the "type of expression is ambiguous without more context" error.

A reproducible test case:

import SwiftUI

enum TestBugEnum {
    case bugEnumCase(field1: Int, field2: Int, field3: Int)
}

struct TestBug: View {
    var enum_var: TestBugEnum
    var body: some View {
        if case let .bugEnumCase(field1: bug, field2: _) = enum_var {
            Text("")
        }
    }
}
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added type checker Area → compiler: Semantic analysis diagnostics QoI Bug: Diagnostics Quality of Implementation and removed swift labels Nov 3, 2022
@AnthonyLatsis AnthonyLatsis added failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression SwiftUI Flag: Related to (but not an issue with) SwiftUI labels Dec 22, 2022
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

2 participants