Skip to content

Property in Protocol extension with a Self constraint can produce uncompilable bridge #534

@abdulowork

Description

@abdulowork

Reproduction

Found while running #486 on Alamofire. I think the gist of the issue is the following:

public protocol DownloadResponseSerializerProtocol {
    associatedtype SerializedObject
}
public struct URLResponseSerializer: DownloadResponseSerializerProtocol {
    public typealias SerializedObject = String
}
extension DownloadResponseSerializerProtocol where Self == URLResponseSerializer {
    public var url: URLResponseSerializer { fatalError("...") }
}

this code as of 5764bc2a1b706056121109dc0ab14fd3d771cbc5 fails the Swift bridge compilation with:

error: property 'url' requires the types 'Self' and 'URLResponseSerializer' be equivalent
 16 | @_cdecl("swiftjava_MySwiftLibrary_DownloadResponseSerializerProtocol_url$get")
 17 | public func swiftjava_MySwiftLibrary_DownloadResponseSerializerProtocol_url$get(_ self: UnsafeRawPointer, _ _result: UnsafeMutableRawPointer) {
 18 |   _result.assumingMemoryBound(to: URLResponseSerializer.self).initialize(to: self.assumingMemoryBound(to: DownloadResponseSerializerProtocol.self).pointee.url)
    |                                                                                                                                                            `- error: property 'url' requires the types 'Self' and 'URLResponseSerializer' be equivalent

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:jextractIssues related to jextract-swift

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions