// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -sil-inline-threshold 0 -emit-sil -primary-file %s | %FileCheck %s // CHECK-NOT: generic specialization of specialize_self.cast (A) -> Swift.Optional // CHECK-LABEL: specialize_self.cast(A) -> Swift.Optional // CHECK-NEXT: sil hidden @_T015specialize_self4cast{{[_0-9a-zA-Z]*}}F : $@convention(thin) (@in T) -> @out Optional func cast(_ x: T) -> R? { return x as? R } // CHECK-LABEL: static specialize_self.Base.returnIfSelf(Swift.AnyObject) -> Swift.Optional // CHECK-NEXT: sil hidden @_T015specialize_self4BaseC12returnIfSelf{{[_0-9a-zA-Z]*}}FZ : $@convention(method) (@owned AnyObject, @thick Base.Type) -> @owned Optional // CHECK: [[CAST:%[0-9]+]] = function_ref @_T015specialize_self4cast{{[_0-9a-zA-Z]*}}F // CHECK: apply [[CAST]] class Base { class func returnIfSelf(_ x: AnyObject) -> Self? { return cast(x) } }