diff --git a/lib/ASTGen/Sources/ASTGen/Decls.swift b/lib/ASTGen/Sources/ASTGen/Decls.swift index 17c7bae0e73..62e275dac7d 100644 --- a/lib/ASTGen/Sources/ASTGen/Decls.swift +++ b/lib/ASTGen/Sources/ASTGen/Decls.swift @@ -393,6 +393,12 @@ extension ASTGenVisitor { return .modify case .`init`: return .`init` + case .read: + precondition(ctx.langOptsHasFeature(.CoroutineAccessors), "(compiler bug) 'read' accessor should only be parsed with 'CoroutineAccessors' feature") + return .read2 + case .modify: + precondition(ctx.langOptsHasFeature(.CoroutineAccessors), "(compiler bug) 'modify' accessor should only be parsed with 'CoroutineAccessors' feature") + return .modify2 default: self.diagnose(.unknownAccessorSpecifier(specifier)) return nil diff --git a/test/ASTGen/decls.swift b/test/ASTGen/decls.swift index 53a483ffcf5..afa080b51c8 100644 --- a/test/ASTGen/decls.swift +++ b/test/ASTGen/decls.swift @@ -1,17 +1,20 @@ // RUN: %empty-directory(%t) // RUN: %target-swift-frontend-dump-parse -disable-availability-checking -enable-experimental-move-only -enable-experimental-concurrency -enable-experimental-feature ParserASTGen \ +// RUN: -enable-experimental-feature CoroutineAccessors \ // RUN: | %sanitize-address > %t/astgen.ast // RUN: %target-swift-frontend-dump-parse -disable-availability-checking -enable-experimental-move-only -enable-experimental-concurrency \ +// RUN: -enable-experimental-feature CoroutineAccessors \ // RUN: | %sanitize-address > %t/cpp-parser.ast // RUN: %diff -u %t/astgen.ast %t/cpp-parser.ast -// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-concurrency -enable-experimental-feature ParserASTGen) +// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-concurrency -enable-experimental-feature CoroutineAccessors -enable-experimental-feature ParserASTGen) // REQUIRES: executable_test // REQUIRES: swift_swift_parser // REQUIRES: swift_feature_ParserASTGen +// REQUIRES: swift_feature_CoroutineAccessors // rdar://116686158 // UNSUPPORTED: asan @@ -108,6 +111,10 @@ func testVars() { var s: Int { get async throws { return 0 } } + var t: Int { + read { yield q } + modify { yield &q } + } } func rethrowingFn(fn: () throws -> Void) rethrows {}