From c85ebdaed5c3c0c3a0b7d283cc1c60e2f04f761a Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Wed, 15 Apr 2026 12:34:46 -0700 Subject: [PATCH] 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). --- include/swift/Basic/Features.def | 2 -- lib/AST/Decl.cpp | 11 ++--------- test/ModuleInterface/coroutine_accessors.swift | 4 ++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/include/swift/Basic/Features.def b/include/swift/Basic/Features.def index c648abac98e..2085c506c1f 100644 --- a/include/swift/Basic/Features.def +++ b/include/swift/Basic/Features.def @@ -524,8 +524,6 @@ EXPERIMENTAL_FEATURE(ImportCxxMembersLazily, true) // TODO: When this is turned on by default, take care of: // * "TODO" around line 8100 of lib/Parse/ParseDecl.cpp // (Don't diagnose bare "read"/"modify" in accessors in source files.) -// * "TODO" around line 12475 of lib/AST/Decl.cpp -// (Don't use "read"/"modify" in swiftinterface files.) SUPPRESSIBLE_EXPERIMENTAL_FEATURE(CoroutineAccessors, true) /// `yielding borrow` and `yielding mutate` coroutine diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index dceb4feca7f..fa2b8c93c0f 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -12597,15 +12597,8 @@ StringRef swift::getAccessorLabel(AccessorKind kind) { #define ACCESSOR(ID, KEYWORD) #include "swift/AST/AccessorKinds.def" - // Transitional terminology. Let's use this for a little - // while to ease the transition. (Both forms are parsed - // correctly, this just changes what gets written into - // .swiftinterface files.) - case AccessorKind::YieldingBorrow: return "read"; - case AccessorKind::YieldingMutate: return "modify"; - // TODO: Switch to the final terminology before shipping... - // case AccessorKind::YieldingBorrow: return "yielding borrow"; - // case AccessorKind::YieldingMutate: return "yielding mutate"; + case AccessorKind::YieldingBorrow: return "yielding borrow"; + case AccessorKind::YieldingMutate: return "yielding mutate"; } llvm_unreachable("bad accessor kind"); } diff --git a/test/ModuleInterface/coroutine_accessors.swift b/test/ModuleInterface/coroutine_accessors.swift index 89ea6e170a1..3e842fe92cb 100644 --- a/test/ModuleInterface/coroutine_accessors.swift +++ b/test/ModuleInterface/coroutine_accessors.swift @@ -12,8 +12,8 @@ var _i: Int = 0 // CHECK: #if compiler(>=5.3) && $CoroutineAccessors // CHECK-NEXT: public var i: Swift::Int { -// CHECK-NEXT: read -// CHECK-NEXT: modify +// CHECK-NEXT: yielding borrow +// CHECK-NEXT: yielding mutate // CHECK-NEXT: } // CHECK-NEXT: #else // CHECK-NEXT: public var i: Swift::Int {