Files
swift-mirror/test/SIL/Serialization/default_override.sil
Tim Kientzle 4955bc4568 [SE-0474] use new "yielding borrow" terminology in SIL printing
To help reduce cognitive burden for future Swift compiler engineers,
let's use the same terminology for coroutine accessors in SIL dumps
as we use in the surface language and inside the compiler.

This really just changes two lines in SILPrinter.cpp and updates
a lot of tests.  I've also copied one test to preserve the old syntax
to make sure that SIL parsing still accepts it.  That should hopefully
prevent unfortunate round-tripping issues while these changes settle.
2026-01-09 10:10:18 -08:00

47 lines
2.0 KiB
Plaintext

// sil (this file) -> sib -> sib -> sil | FileCheck
// RUN: %empty-directory(%t)
// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name default_override -enable-library-evolution -enable-experimental-feature CoroutineAccessors
// RUN: %target-sil-opt %t/tmp.sib -emit-sib -o %t/tmp.2.sib -module-name default_override -enable-library-evolution -enable-experimental-feature CoroutineAccessors
// RUN: %target-sil-opt %t/tmp.2.sib -module-name default_override -emit-sorted-sil -enable-library-evolution -enable-experimental-feature CoroutineAccessors | %FileCheck %s
// REQUIRES: swift_feature_CoroutineAccessors
sil_stage canonical
import Builtin
struct Int {
var _value: Builtin.Int64
}
open class B {
open var i: Int { yielding borrow set }
}
sil @B_i_read : $@yield_once @convention(method) (@guaranteed B) -> @yields Int
sil @B_i_read2 : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields Int
sil @B_i_set : $@convention(method) (Int, @guaranteed B) -> ()
sil @B_i_modify : $@yield_once @convention(method) (@guaranteed B) -> @yields @inout Int
sil @B_i_modify2 : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int
sil_vtable B {
#B.i!read: (B) -> () -> () : @B_i_read
#B.i!read2: (B) -> () -> () : @B_i_read2
#B.i!setter: (B) -> (Int) -> () : @B_i_set
#B.i!modify: (B) -> () -> () : @B_i_modify
#B.i!modify2: (B) -> () -> () : @B_i_modify2
}
sil @B_i_read2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields Int
sil @B_i_modify2_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int
// CHECK-LABEL: sil_default_override_table B {
// CHECK-NEXT: #B.i!yielding_borrow: #B.i!read: (B) -> () -> () : @B_i_read2_default_override
// CHECK-NEXT: #B.i!yielding_mutate: #B.i!modify: (B) -> () -> () : @B_i_modify2_default_override
// CHECK-NEXT: }
sil_default_override_table B {
#B.i!read2: #B.i!read: (B) -> () -> () : @B_i_read2_default_override
#B.i!modify2: #B.i!modify: (B) -> () -> () : @B_i_modify2_default_override
}