mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Parse concurrency syntax when parsing for syntax-tree-only mode.
This allows the syntax parser library and SwiftSyntax to successfully parse code using this experimental feature without requiring an API to pass compiler flags into the parser.
This commit is contained in:
28
test/Syntax/Parser/async.swift
Normal file
28
test/Syntax/Parser/async.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
// Verify that async parses correctly via the parser lib even without the
|
||||
// experimental flag being set in LangOpts.
|
||||
//
|
||||
// REQUIRES: syntax_parser_lib
|
||||
// RUN: %swift-syntax-parser-test %s -dump-diags 2>&1 | %FileCheck %s
|
||||
|
||||
func asyncGlobal1() async { }
|
||||
func asyncGlobal2() async throws { }
|
||||
|
||||
typealias AsyncFunc1 = () async -> ()
|
||||
typealias AsyncFunc2 = () async throws -> ()
|
||||
|
||||
func testTypeExprs() {
|
||||
let _ = [() async -> ()]()
|
||||
let _ = [() async throws -> ()]()
|
||||
}
|
||||
|
||||
func testAwaitOperator() async {
|
||||
let _ = __await asyncGlobal1()
|
||||
}
|
||||
|
||||
func testAsyncClosure() {
|
||||
let _ = { () async in 5 }
|
||||
let _ = { () throws in 5 }
|
||||
let _ = { () async throws in 5 }
|
||||
}
|
||||
|
||||
// CHECK: 0 error(s) 0 warnings(s) 0 note(s)
|
||||
Reference in New Issue
Block a user