Files
swift-mirror/test/ModuleInterface/coroutine_accessors.swift
T
Tim Kientzle c85ebdaed5 Write yielding accessor names to swiftinterface files
Back in January, I updated the swiftinterface _reading_ code to accept either
`read`/`modify` or `yielding borrow`/`yielding mutate`.  That update has been
around for long enough that we can now switch over the swiftinterface _writing_
code to emit the standard final `yielding borrow`/`yielding mutate` spellings.

Interface files written with the old spellings will continue to be
accepted for some time (likely a year or more).
2026-04-15 12:34:46 -07:00

32 lines
831 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) \
// RUN: %s \
// RUN: -enable-experimental-feature CoroutineAccessors \
// RUN: -module-name Rock
// RUN: %FileCheck %s < %t.swiftinterface
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Rock
// REQUIRES: swift_feature_CoroutineAccessors
var _i: Int = 0
// CHECK: #if compiler(>=5.3) && $CoroutineAccessors
// CHECK-NEXT: public var i: Swift::Int {
// CHECK-NEXT: yielding borrow
// CHECK-NEXT: yielding mutate
// CHECK-NEXT: }
// CHECK-NEXT: #else
// CHECK-NEXT: public var i: Swift::Int {
// CHECK-NEXT: _read
// CHECK-NEXT: _modify
// CHECK-NEXT: }
// CHECK-NEXT: #endif
public var i: Int {
yielding borrow {
yield _i
}
yielding mutate {
yield &_i
}
}