[Feature Request] No HelperCoder generated when check compilation condition
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- swift
- Domínio
- build-system
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
- 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
- Linguagem predominante
- Swift
- Estrelas
- 779
- Forks
- 46
- Merge médio
- 9h 7min
- PRs com merge (30d)
- 2
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de SwiftyLab/MetaCodable
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
SwiftyLab/MetaCodable#169 ·
-
enhancement good first issue
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 32/100
SwiftyLab/MetaCodable#49 · 5 comentários · 2 reações ·
Todas as issues de SwiftyLab/MetaCodable
Issues semelhantes
-
Update ghostty to 1.4.0Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
RealtimeV2 fails to compile on Xcode 27.1 / Swift 6.4: ambiguous implicit access level for import of 'HTTPTypes'Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. AbertaRealtime swift
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
supabase/supabase-swift#1647 ·
Mantenedores costumam responder em até 1 dia
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
NobiResearch/Ovenbird#148 ·
Mantenedores costumam responder em até 1 dia
-
auth type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
googleapis/google-cloud-swift#1549 ·
Mantenedores costumam responder em até 1 dia