-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Labels
feature:jextractIssues related to jextract-swiftIssues related to jextract-swift
Description
When generating .swiftinterface files using the -emit-module-interface flag, unexpected #if blocks are often generated. For example:
- Original
.swift
public struct AppStore: Sendable, Codable {
public var storeURL: URL?
public init(storeURL: URL?) {
self.storeURL = storeURL
}
}- Generated
.swiftinterface
public struct AppStore : Swift.Sendable, Swift.Codable {
public var storeURL: Foundation.URL?
#if compiler(>=5.3) && $NonescapableTypes
public init(storeURL: Foundation.URL?)
#endif
public func encode(to encoder: any Swift.Encoder) throws
public init(from decoder: any Swift.Decoder) throws
}The Problem
The exact reason for this behavior is unclear, but expressions like #if compiler(>=5.3) && $NonescapableTypes appear in various places within generated interfaces.
Currently, Swift2JavaVisitor ignores IfConfigDecl entirely.
As a result, any method or property signatures wrapped in these #if blocks are lost.
Proposed Solution
We could potentially use SwiftIfConfig to evaluate these blocks.
Although providing a full BuildConfiguration might be complex, it would be highly beneficial to at least support simple, common patterns.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature:jextractIssues related to jextract-swiftIssues related to jextract-swift