Skip to content

Fix a couple build warnings #2202

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions Sources/CompletionScoring/Utilities/SwiftExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ extension RandomAccessCollection {
return body(scratchArea)
}

package func concurrentCompactMap<T>(_ f: @Sendable (Element) -> T?) -> [T] where Self: Sendable {
package func concurrentCompactMap<T>(_ f: @Sendable (Element) -> T?) -> [T] where Self: Sendable, Index: Sendable {
return withMapScratchArea { (results: UnsafeMutablePointer<T?>) -> [T] in
// `nonisolated(unsafe)` is fine because we write to different offsets within the buffer on every concurrent
// iteration.
Expand All @@ -245,7 +245,7 @@ extension RandomAccessCollection {
}
}

package func concurrentMap<T>(_ f: @Sendable (Element) -> T) -> [T] where Self: Sendable {
package func concurrentMap<T>(_ f: @Sendable (Element) -> T) -> [T] where Self: Sendable, Index: Sendable {
return withMapScratchArea { (results: UnsafeMutablePointer<T>) -> [T] in
// `nonisolated(unsafe)` is fine because we write to different offsets within the buffer on every concurrent
// iteration.
Expand Down Expand Up @@ -290,7 +290,7 @@ protocol ContiguousZeroBasedIndexedCollection: Collection where Index == Int {
}

extension ContiguousZeroBasedIndexedCollection {
func slicedConcurrentForEachSliceRange(body: @Sendable (Range<Index>) -> Void) {
func slicedConcurrentForEachSliceRange(body: @Sendable (Range<Index>) -> Void) where Self: SendableMetatype {
// We want to use `DispatchQueue.concurrentPerform`, but we want to be called only a few times. So that we
// can amortize per-callback work. We also want to oversubscribe so that we can efficiently use
// heterogeneous CPUs. If we had 4 efficiency cores, and 4 performance cores, and we dispatched 8 work items
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKLogging/LoggingScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ package final class LoggingScope {
package func withLoggingSubsystemAndScope<Result>(
subsystem: String,
scope: String?,
@_inheritActorContext _ operation: @Sendable () throws -> Result
_ operation: @Sendable () throws -> Result
) rethrows -> Result {
return try LoggingScope.$_subsystem.withValue(subsystem) {
return try LoggingScope.$_scope.withValue(scope, operation: operation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import SwiftSyntax

/// Describes types that provide one or more code actions based on purely
/// syntactic information.
protocol SyntaxCodeActionProvider {
protocol SyntaxCodeActionProvider: SendableMetatype {
/// Produce code actions within the given scope. Each code action
/// corresponds to one syntactic transformation that can be performed, such
/// as adding or removing separators from an integer literal.
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftExtensions/AsyncUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ package func withCancellableCheckedThrowingContinuation<Handle: Sendable, Result
)
}

extension Collection where Element: Sendable {
extension Collection where Self: Sendable, Element: Sendable {
/// Transforms all elements in the collection concurrently and returns the transformed collection.
package func concurrentMap<TransformedElement: Sendable>(
maxConcurrentTasks: Int = ProcessInfo.processInfo.processorCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ struct SwiftPMBuildSystemTests {
// We opened the project from a symlink. The realpath isn't part of the project and we should thus not receive
// build settings for it.
#expect(
try await #require(
try #require(
await buildSystemManager.buildSettingsInferredFromMainFile(
for: DocumentURI(aswiftReal),
language: .swift,
Expand Down