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-14508] Failed to produce diagnostic on accidentally pattern-matching on struct #56860

Closed
typesanitizer opened this issue Apr 19, 2021 · 2 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

Comments

@typesanitizer
Copy link

Previous ID SR-14508
Radar rdar://problem/76825572
Original Reporter @typesanitizer
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee None
Priority Medium

md5: 52d4efe57340bfe4c2ff8f6c45bb7c5f

Issue Description:

import SwiftUI

struct S {}

struct V: View {
  var s: S
  var body: some View {
    switch self.s {
    case .a(_): Text("")
    }
  }
}

This fails to produce a diagnostic on a recent-ish main compiler @ a93593a (Apr 8).

@typesanitizer
Copy link
Author

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@xedin
Copy link
Member

xedin commented Jul 13, 2022

Fixed in 5.7:

error: '_' can only appear in a pattern or on the left side of an assignment
    case .a(_): Text("")
            ^
error: type 'S' has no member 'a' 
    switch self.s {
                ^

@xedin xedin closed this as completed Jul 13, 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
Projects
None yet
Development

No branches or pull requests

2 participants