[Feature Request] No HelperCoder generated when check compilation condition
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ệ
- swift
- Lĩnh vực
- build-system
Hướng nghiên cứu
Start by reproducing the reported build in a Swift package using the swiftSettings compilation condition and the provided ResponseAttributes and Response declarations. Read the macro and plugin paths that generate ResponseAttributesCoder, then check how they handle declarations inside #if conditions. Done means the conditional example compiles and generates the coder without breaking the working example.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- I have read the documentation.
Describe the bug
Below code works well.
working code
@Codable
@CodedAs<String?>
@CodedAt("operation")
protocol ResponseAttributes {}
@Codable
struct Response {
@CodedIn("data")
let id: String
@CodedIn("data")
let type: String
@CodedIn("data")
@CodedBy(ResponseAttributesCoder())
let attributes: ResponseAttributes
}
@Codable
struct RegistrationAttributes: ResponseAttributes, DynamicCodable {
static var identifier: DynamicCodableIdentifier<String?> { .one("REGISTRATION") }
let id: String
@CodedAt("status-code")
let statusCode: String
let operation: String
}
@Codable
struct VerificationAttributes: ResponseAttributes, DynamicCodable {
static var identifier: DynamicCodableIdentifier<String?> { .one(nil) }
let id: String
let operation: String?
let expiresIn: UInt
@CodedAt("xxx-token")
let xxxToken: String
@CodedAt("yyy-token")
let yyyToken: String
}
But the ResponseAttributesCoder will be missing if add #if SOME_SWIFT_ACTIVE_COMPILATION_CONDITION.
Xcode say 'Cannot find 'AnonymousAttestationResponseAttributesCoder' in scope'.
failed to work
// Have set the `SOME_SWIFT_ACTIVE_COMPILATION_CONDITION` in `swiftSettings` from `Package.swift`.
#if SOME_SWIFT_ACTIVE_COMPILATION_CONDITION
@Codable
@CodedAs<String?>
@CodedAt("operation")
protocol ResponseAttributes {}
@Codable
struct Response {
@CodedIn("data")
let id: String
@CodedIn("data")
let type: String
@CodedIn("data")
@CodedBy(ResponseAttributesCoder())
let attributes: ResponseAttributes
}
@Codable
struct RegistrationAttributes: ResponseAttributes, DynamicCodable {
static var identifier: DynamicCodableIdentifier<String?> { .one("REGISTRATION") }
let id: String
@CodedAt("status-code")
let statusCode: String
let operation: String
}
@Codable
struct VerificationAttributes: ResponseAttributes, DynamicCodable {
static var identifier: DynamicCodableIdentifier<String?> { .one(nil) }
let id: String
let operation: String?
let expiresIn: UInt
@CodedAt("xxx-token")
let xxxToken: String
@CodedAt("yyy-token")
let yyyToken: String
}
#endif
To Reproduce
Steps to reproduce the behavior:
- Create an empty swift package
- Add MetaCodable to dependencies
- Copy and paste the code above
- commnad + B
Expected behavior
Compilation condition check shouldn't fail plugin or macro.
Environment (please complete the following information, remove ones not applicable):
- OS: macOS
- Version 13.6.6
- Xcode 15.2
- Swift 5.9.2
- Ngôn ngữ chính
- Swift
- Star
- 779
- Fork
- 46
- Merge trung bình
- 9 giờ 7 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SwiftyLab/MetaCodable
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
SwiftyLab/MetaCodable#169 ·
-
enhancement good first issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
SwiftyLab/MetaCodable#49 · 5 bình luận · 2 reaction ·
Tất cả issue của SwiftyLab/MetaCodable
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
simulator-session.yml の simtunnel の固定先が古く、agentd が無いため simtunnel up --wait / status が準備完了を検知できないĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Ebullioscopic/Atoll#900 ·
Maintainer thường phản hồi trong vòng 2 ngày