Open Veence opened 2 years ago
The fails to produce diagnostic should probably have been fixed by @xedin and @ahoppen recent work on pattern matching. On main we see
Exit Code: 1
Command Output (stderr):
--
.../file.swift:21:19: error: unexpected error produced: type '_ErrorCodeProtocol' has no member 'ok'
case .ok (let message):
^
.../file.swift:21:34: error: unexpected error produced: expression pattern of type '(_) -> StatusBarMessage' cannot match values of type 'StatusBarMessage'
case .ok (let message):
^
.../file.swift:22:15: error: unexpected error produced: closure containing control flow statement cannot be used with result builder 'ViewBuilder'
break
^
SwiftUI.ViewBuilder:2:30: note: diagnostic produced elsewhere: struct 'ViewBuilder' declared here
@resultBuilder public struct ViewBuilder {
^
But that type '_ErrorCodeProtocol' has no member 'ok'
looks a bit off
Probably at least partially by https://github.com/apple/swift/pull/59210 which changed how these patterns are handled. I think we can resolve this if failure to produce a diagnostic is fixed on main.
Similar error:
import SwiftUI
struct ContentView: View {
@State private var appState: AppState = .start
var body: some View {
switch appState {
case .Start:
Button("getText") {
print("pressed")
}
case .Finished(let text):
Text(text)
case .Processing(let text):
ProgressView()
}
}
}
enum AppState {
case start, processing(text: String?), finished(text: String)
}
This code:
Where
status
should bestatus.message
fails to produce a diagnostic (or rather ends up with the message quoted in subject).