// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -global-property-opt %s | %FileCheck %s // REQUIRES: objc_interop sil_stage canonical import Builtin import Swift import SwiftShims public class X { } // CHECK-LABEL: sil @test_unknown_init // CHECK: [[F:%[0-9]+]] = function_ref @_is_native_X_no_type_check // CHECK: [[R:%[0-9]+]] = apply [[F]] // CHECK: return [[R]] sil @test_unknown_init : $@convention(thin) (@owned _ArrayBuffer) -> Bool { bb0(%0 : $_ArrayBuffer): %a1 = struct $Array (%0 : $_ArrayBuffer) %f1 = function_ref @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array) -> Bool %10 = apply %f1(%a1) : $@convention(method) (@guaranteed Array) -> Bool return %10 : $Bool } // CHECK-LABEL: sil @test_buffer_overwritten // CHECK: [[F:%[0-9]+]] = function_ref @_is_native_X_no_type_check // CHECK: [[R:%[0-9]+]] = apply [[F]] // CHECK: return [[R]] sil @test_buffer_overwritten : $@convention(thin) (@owned _ArrayBuffer) -> Bool { bb0(%0 : $_ArrayBuffer): %1 = alloc_stack $Array %3 = function_ref @_array_X_init : $@convention(thin) () -> @owned Array %4 = apply %3() : $@convention(thin) () -> @owned Array store %4 to %1 : $*Array %b1 = struct_element_addr %1 : $*Array, #Array._buffer store %0 to %b1 : $*_ArrayBuffer %5 = load %1 : $*Array %6 = function_ref @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array) -> Bool %10 = apply %6(%5) : $@convention(method) (@guaranteed Array) -> Bool dealloc_stack %1 : $*Array return %10 : $Bool } sil [_semantics "array.init"] @_array_X_init : $@convention(thin) () -> @owned Array sil [_semantics "array.props.isNativeTypeChecked"] @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array) -> Bool