mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL type lowering erases DynamicSelfType, so we generate incorrect code when casting to DynamicSelfType. Fixing this requires a fair amount of plumbing, but most of the changes are mechanical. Note that the textual SIL syntax for casts has changed slightly; the target type is now a formal type without a '$', not a SIL type. Also, the unconditional_checked_cast_value and checked_cast_value_br instructions now take the _source_ formal type as well, just like the *_addr forms they are intended to replace.
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_public_non_abi.sil
|
|
// RUN: %target-swift-frontend -emit-sil -I %t %s | %FileCheck %s
|
|
|
|
sil_stage raw
|
|
|
|
import def_public_non_abi
|
|
import Builtin
|
|
import Swift
|
|
|
|
// CHECK-LABEL: sil @top_level_code
|
|
// CHECK: function_ref @public_non_abi_function : $@convention(thin) () -> ()
|
|
// CHECK: return
|
|
|
|
sil @top_level_code : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @public_non_abi_function : $@convention(thin) () -> ()
|
|
%1 = tuple ()
|
|
return %1 : $()
|
|
}
|
|
|
|
// Make sure the function body is deserialized.
|
|
// CHECK-LABEL: sil shared_external [serialized] @public_non_abi_function : $@convention(thin) () -> ()
|
|
// CHECK: function_ref @other_public_non_abi_function
|
|
// CHECK: return
|
|
sil hidden_external [serialized] @public_non_abi_function : $@convention(thin) () -> ()
|
|
|
|
// Make sure the function body is deserialized.
|
|
// CHECK-LABEL: sil shared_external [serialized] @other_public_non_abi_function : $@convention(thin) () -> ()
|
|
// CHECK: return
|