Files
swift-mirror/validation-test/Sema/SwiftUI/rdar70256351.swift
Pavel Yaskevich 1d3f3204ca [ResultBuilders] Account of a fact that re-write of a statement can fail
If one of the statements in the result builder body fails to
apply solution, let's fail entire rewrite attempt, otherwise
type-checker would end up with AST that has null pointers for
some child nodes.

Resolves: rdar://problem/70256351
2020-11-05 16:29:58 -08:00

20 lines
566 B
Swift

// RUN: %target-typecheck-verify-swift -target x86_64-apple-macosx10.15 -swift-version 5
// REQUIRES: objc_interop
// REQUIRES: OS=macosx
import SwiftUI
struct ContentView: View {
@State private var currentPage = "1"
var body: some View {
switch currentPage {
case 1: // expected-error {{expression pattern of type 'Int' cannot match values of type 'String'}}
// expected-note@-1 {{overloads for '~=' exist with these partially matching parameter lists: (Substring, String)}}
Text("1")
default:
Text("default")
}
}
}