Skip to content

[test] Enable some language features in validation-test lit config #39881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2_fixed/rdar70144083.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// REQUIRES: concurrency

@available(SwiftStdlib 5.5, *)
public protocol AsyncIteratorProtocol {
associatedtype Element
associatedtype Failure: Error
Expand All @@ -10,6 +11,7 @@ public protocol AsyncIteratorProtocol {
mutating func cancel()
}

@available(SwiftStdlib 5.5, *)
public protocol AsyncSequence {
associatedtype Element
associatedtype Failure: Error
Expand All @@ -18,6 +20,7 @@ public protocol AsyncSequence {
func makeAsyncIterator() -> AsyncIterator
}

@available(SwiftStdlib 5.5, *)
struct Just<Element>: AsyncSequence {
typealias Failure = Never

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %target-swift-frontend %s -emit-ir -enable-library-evolution -enable-experimental-concurrency
// REQUIRES: concurrency

@available(SwiftStdlib 5.5, *)
public class X {
public func f() async { }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %target-swift-frontend %s -emit-ir -enable-library-evolution -enable-experimental-concurrency
// REQUIRES: concurrency

@available(SwiftStdlib 5.5, *)
public protocol P {
func f() async
}
2 changes: 2 additions & 0 deletions validation-test/compiler_crashers_2_fixed/rdar71816041.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// RUN: %target-swift-frontend -emit-ir -primary-file %s -enable-experimental-concurrency
// REQUIRES: concurrency

@available(SwiftStdlib 5.5, *)
func getIntAndString() async -> (Int, String) { (5, "1") }

@available(SwiftStdlib 5.5, *)
func testDecompose() async -> Int {
async let (i, s) = await getIntAndString()
return await i
Expand Down
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2_fixed/rdar72397303.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// RUN: %target-swift-frontend %s -emit-ir -enable-experimental-concurrency
// REQUIRES: concurrency

@available(SwiftStdlib 5.5, *)
protocol P {
func f<T>() async throws -> T?
}
@available(SwiftStdlib 5.5, *)
extension P {
func f<T>() async throws -> T? { nil }
}
@available(SwiftStdlib 5.5, *)
class X: P {}

3 changes: 2 additions & 1 deletion validation-test/compiler_crashers_2_fixed/sr15248.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %target-swift-frontend -emit-ir %s
// REQUIRES: concurrency

private struct TransformResult<T> {
var index: Int
var transformedElement: T
Expand All @@ -11,7 +12,7 @@ private struct TransformResult<T> {
}

public extension Collection {
@available(macOS 12.0.0, *)
@available(SwiftStdlib 5.5, *)
private func f<T>(_ transform: @escaping (Element) async throws -> T) async throws -> [T] {
return try await withThrowingTaskGroup(of: TransformResult<T>.self) { group in
return []
Expand Down
9 changes: 9 additions & 0 deletions validation-test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ else:
# even if SWIFT_USE_LINKER isn't set, we cannot use BFD for Android
config.android_linker_name = "gold"

if "@SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING@" == "TRUE":
config.available_features.add('differentiable_programming')
if "@SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY@" == "TRUE":
config.available_features.add('concurrency')
if "@SWIFT_BACK_DEPLOY_CONCURRENCY@" == "TRUE":
config.available_features.add('back_deploy_concurrency')
if "@SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED@" == "TRUE":
config.available_features.add('distributed')

# Let the main config do the real work.
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))
lit_config.load_config(config, "@SWIFT_SOURCE_DIR@/validation-test/lit.cfg")