diff --git a/CMakeLists.txt b/CMakeLists.txt index eeca45548..d23ea604d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -add_compile_options("$<$:SHELL:-enable-upcoming-feature InternalImportsByDefault -enable-upcoming-feature MemberImportVisibility>") +add_compile_options( + "$<$:SHELL:-enable-upcoming-feature InternalImportsByDefault>" + "$<$:SHELL:-enable-upcoming-feature MemberImportVisibility>" + "$<$:SHELL:-enable-upcoming-feature InferIsolatedConformances>" + "$<$:SHELL:-enable-upcoming-feature NonisolatedNonsendingByDefault>" +) find_package(dispatch QUIET) find_package(Foundation QUIET) diff --git a/Package.swift b/Package.swift index 4c8cd945a..b105adad3 100644 --- a/Package.swift +++ b/Package.swift @@ -8,6 +8,8 @@ var globalSwiftSettings: [SwiftSetting] { var result: [SwiftSetting] = [ .enableUpcomingFeature("InternalImportsByDefault"), .enableUpcomingFeature("MemberImportVisibility"), + .enableUpcomingFeature("InferIsolatedConformances"), + .enableUpcomingFeature("NonisolatedNonsendingByDefault"), ] if noSwiftPMDependency { result += [.define("NO_SWIFTPM_DEPENDENCY")] diff --git a/Sources/SKLogging/LoggingScope.swift b/Sources/SKLogging/LoggingScope.swift index c6cc490f5..c5484c850 100644 --- a/Sources/SKLogging/LoggingScope.swift +++ b/Sources/SKLogging/LoggingScope.swift @@ -54,7 +54,7 @@ package func withLoggingSubsystemAndScope( package func withLoggingSubsystemAndScope( subsystem: String, scope: String?, - @_inheritActorContext _ operation: @Sendable () async throws -> Result + @_inheritActorContext _ operation: @Sendable @concurrent () async throws -> Result ) async rethrows -> Result { return try await LoggingScope.$_subsystem.withValue(subsystem) { return try await LoggingScope.$_scope.withValue(scope, operation: operation) @@ -84,7 +84,7 @@ package func withLoggingScope( /// - SeeAlso: ``withLoggingScope(_:_:)-6qtga`` package func withLoggingScope( _ scope: String, - @_inheritActorContext _ operation: @Sendable () async throws -> Result + @_inheritActorContext _ operation: @Sendable @concurrent () async throws -> Result ) async rethrows -> Result { return try await LoggingScope.$_scope.withValue( scope, diff --git a/Sources/SKLogging/OrLog.swift b/Sources/SKLogging/OrLog.swift index 5c5281192..d8dbdf17e 100644 --- a/Sources/SKLogging/OrLog.swift +++ b/Sources/SKLogging/OrLog.swift @@ -41,7 +41,7 @@ package func orLog( package func orLog( _ prefix: @autoclosure () -> String, level: LogLevel = .error, - @_inheritActorContext _ block: @Sendable () async throws -> R? + _ block: () async throws -> R? ) async -> R? { do { return try await block() diff --git a/Sources/SKTestSupport/Utils.swift b/Sources/SKTestSupport/Utils.swift index fa6b7c538..ff349df7c 100644 --- a/Sources/SKTestSupport/Utils.swift +++ b/Sources/SKTestSupport/Utils.swift @@ -98,7 +98,7 @@ package func testScratchDir(testName: String = #function) throws -> URL { /// The temporary directory will be deleted at the end of `directory` unless the /// `SOURCEKIT_LSP_KEEP_TEST_SCRATCH_DIR` environment variable is set. package func withTestScratchDir( - @_inheritActorContext _ body: @Sendable (URL) async throws -> T, + _ body: (URL) async throws -> T, testName: String = #function ) async throws -> T { let scratchDirectory = try testScratchDir(testName: testName) diff --git a/Sources/SwiftExtensions/AsyncUtils.swift b/Sources/SwiftExtensions/AsyncUtils.swift index 72d921160..ee4704d9f 100644 --- a/Sources/SwiftExtensions/AsyncUtils.swift +++ b/Sources/SwiftExtensions/AsyncUtils.swift @@ -24,7 +24,7 @@ package actor RefCountedCancellableTask { /// Whether the task has been cancelled. package private(set) var isCancelled: Bool = false - package init(priority: TaskPriority? = nil, operation: @escaping @Sendable () async throws -> Success) { + package init(priority: TaskPriority? = nil, operation: @escaping @Sendable @concurrent () async throws -> Success) { self.task = Task(priority: priority, operation: operation) } diff --git a/Sources/SwiftExtensions/Sequence+AsyncMap.swift b/Sources/SwiftExtensions/Sequence+AsyncMap.swift index 835b35413..ae6074552 100644 --- a/Sources/SwiftExtensions/Sequence+AsyncMap.swift +++ b/Sources/SwiftExtensions/Sequence+AsyncMap.swift @@ -13,7 +13,7 @@ extension Sequence { /// Just like `Sequence.map` but allows an `async` transform function. package func asyncMap( - @_inheritActorContext _ transform: @Sendable (Element) async throws -> T + _ transform: (Element) async throws -> T ) async rethrows -> [T] { var result: [T] = [] result.reserveCapacity(self.underestimatedCount) @@ -27,7 +27,7 @@ extension Sequence { /// Just like `Sequence.flatMap` but allows an `async` transform function. package func asyncFlatMap( - @_inheritActorContext _ transform: @Sendable (Element) async throws -> SegmentOfResult + _ transform: (Element) async throws -> SegmentOfResult ) async rethrows -> [SegmentOfResult.Element] { var result: [SegmentOfResult.Element] = [] result.reserveCapacity(self.underestimatedCount) @@ -41,7 +41,7 @@ extension Sequence { /// Just like `Sequence.compactMap` but allows an `async` transform function. package func asyncCompactMap( - @_inheritActorContext _ transform: @Sendable (Element) async throws -> T? + _ transform: (Element) async throws -> T? ) async rethrows -> [T] { var result: [T] = [] @@ -56,7 +56,7 @@ extension Sequence { /// Just like `Sequence.map` but allows an `async` transform function. package func asyncFilter( - @_inheritActorContext _ predicate: @Sendable (Element) async throws -> Bool + _ predicate: (Element) async throws -> Bool ) async rethrows -> [Element] { var result: [Element] = [] @@ -70,9 +70,7 @@ extension Sequence { } /// Just like `Sequence.first` but allows an `async` predicate function. - package func asyncFirst( - @_inheritActorContext where predicate: @Sendable (Element) async throws -> Bool - ) async rethrows -> Element? { + package func asyncFirst(where predicate: (Element) async throws -> Bool) async rethrows -> Element? { for element in self { if try await predicate(element) { return element @@ -84,7 +82,7 @@ extension Sequence { /// Just like `Sequence.contains` but allows an `async` predicate function. package func asyncContains( - @_inheritActorContext where predicate: @Sendable (Element) async throws -> Bool + where predicate: (Element) async throws -> Bool ) async rethrows -> Bool { return try await asyncFirst(where: predicate) != nil }