mirror of
https://github.com/apple/swift.git
synced 2026-10-18 17:49:23 +02:00
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.
45 lines
1.7 KiB
Plaintext
45 lines
1.7 KiB
Plaintext
// RUN: %target-sil-opt %s \
|
|
// RUN: -enable-library-evolution \
|
|
// RUN: -enable-experimental-feature CoroutineAccessors \
|
|
// RUN: | %FileCheck %s
|
|
|
|
// REQUIRES: swift_feature_CoroutineAccessors
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
|
|
struct Int {
|
|
var _value: Builtin.Int64
|
|
}
|
|
|
|
open class B {
|
|
open var i: Int { read set }
|
|
}
|
|
|
|
sil @B_i_read : $@yield_once @convention(method) (@guaranteed B) -> @yields Int
|
|
sil @B_i_yielding_borrow : $@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_yielding_mutate : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields @inout Int
|
|
|
|
sil_vtable B {
|
|
#B.i!read: (B) -> () -> () : @B_i_read
|
|
#B.i!yielding_borrow: (B) -> () -> () : @B_i_yielding_borrow
|
|
#B.i!setter: (B) -> (Int) -> () : @B_i_set
|
|
#B.i!modify: (B) -> () -> () : @B_i_modify
|
|
#B.i!yielding_mutate: (B) -> () -> () : @B_i_yielding_mutate
|
|
}
|
|
|
|
sil @B_i_yielding_borrow_default_override : $@yield_once_2 @convention(method) (@guaranteed B) -> @yields Int
|
|
sil @B_i_yielding_mutate_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_yielding_borrow_default_override
|
|
// CHECK-NEXT: #B.i!yielding_mutate: #B.i!modify: (B) -> () -> () : @B_i_yielding_mutate_default_override
|
|
// CHECK-NEXT: }
|
|
sil_default_override_table B {
|
|
#B.i!yielding_borrow: #B.i!read: (B) -> () -> () : @B_i_yielding_borrow_default_override
|
|
#B.i!yielding_mutate: #B.i!modify: (B) -> () -> () : @B_i_yielding_mutate_default_override
|
|
}
|