// RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s // https://github.com/apple/swift/issues/60806 struct Foo { init(_: (T) -> Void) {} } protocol Bar {} enum Baz: Bar { case someCase(Int) } enum NonBarBaz { case someCase(Int) } let _: Foo = Foo { (a: Bar) -> Void in switch a { // CHECK: (pattern_is type="any Bar" cast_kind=value_cast cast_to="Baz" // CHECK-NEXT: (pattern_enum_element type="Baz" {{.*}} element="Baz.someCase" case let .someCase(value) as Baz: print(value) // expected-warning@-1 {{cast from 'any Bar' to unrelated type 'NonBarBaz' always fails}} case let .someCase(value) as NonBarBaz: print(value) default: break } }