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

Đang mở
#534 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java, swift
Lĩnh vực
compilers

Hướng nghiên cứu

Bắt đầu với protocol và extension bị ràng buộc trong reproduction, sau đó kiểm tra quá trình tạo Swift bridge phát ra swiftjava_MySwiftLibrary_DownloadResponseSerializerProtocol_url$get. Xác nhận rằng bridge được tạo xử lý ràng buộc Self == URLResponseSerializer mà không tạo ra lỗi compiler được báo cáo, và xác thực reproduction ban đầu với commit 5764bc2a1b706056121109dc0ab14fd3d771cbc5.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature:jextract

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
Ngôn ngữ chính
Swift
Star
1.3k
Fork
127
Merge trung bình
2 ngày 14 giờ
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của swiftlang/swift-java

Tất cả issue của swiftlang/swift-java

Issue tương tự

Thêm issue về Swift

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.