Files
swift-mirror/test/SILOptimizer/anyhashable_to_protocol.swift
2022-08-18 01:15:12 -04:00

19 lines
402 B
Swift

// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
// REQUIRES: objc_interop
import Foundation
protocol FooProtocol : class {
}
class FooProtocolImplementation : NSObject, FooProtocol {
}
// CHECK-LABEL: sil @{{.*}}testit
// CHECK: checked_cast_addr_br {{.*}} AnyHashable {{.*}} to any FooProtocol
public func testit(_ x: AnyHashable) -> Bool {
return (x as? FooProtocol) != nil
}