Closed zunda-pixel closed 8 months ago
swift-http-types(package) has overload named URLSession.data(for request: HTTPRequest) And my project has overload named URLSession.data(for request: some Request)
URLSession.data(for request: HTTPRequest)
URLSession.data(for request: some Request)
This combination can be build on macOS, but not Linux(Ubuntu)
Sample Project: https://github.com/zunda-pixel/swift-bug-overload
/swift-bug-same-argument/Sources/Library1/Library1.swift:25:27: error: instance method 'data(for:)' requires that 'HTTPRequest' conform to 'Request' return try await self.data(for: request) ^ /swift-bug-same-argument/Sources/Library1/Library1.swift:18:15: note: where 'some Request' = 'HTTPRequest' public func data(for request: some Request) async throws -> (Data, HTTPResponse) { ^ error: fatalError Error: Process completed with exit code 1.
import Foundation import HTTPTypes import HTTPTypesFoundation #if canImport(FoundationNetworking) import FoundationNetworking #endif extension URLSession { public func data(for request: some Request) async throws -> (Data, HTTPResponse) { let request = HTTPRequest( method: request.method, url: request.url, headerFields: request.headers ) return try await self.data(for: request) } }
can be build on Linux(Ubuntu)
swift 5.9.2
No response
this issue is wrong... I didn't know that Swift for Linux doesn't have Concurrency Method URLSession.
Swift for Linux
URLSession
Description
swift-http-types(package) has overload named
URLSession.data(for request: HTTPRequest)
And my project has overload namedURLSession.data(for request: some Request)
This combination can be build on macOS, but not Linux(Ubuntu)
Sample Project: https://github.com/zunda-pixel/swift-bug-overload
Error Log
Reproduction
Expected behavior
can be build on Linux(Ubuntu)
Environment
swift 5.9.2
Additional information
No response