Skip to content

Commit 792a9ae

Browse files
committed
SwiftExtract: doc cleanup, drop default knob impls, drop swift-5 mode on tests
Three small review-driven cleanups: - `SwiftAnalyzer` doc: drop the parenthetical example in the lead-in and fix "language-neutral" to "output is language-neutral"; drop the "useful for tests / no code generation" sentence on the static `analyze` convenience. - `SwiftExtractConfiguration`: remove the protocol-extension defaults for `extractsOperators` and `extractsGenericTypeInitializers`. Both are semantic decisions about what the analysis layer should do for a given language target; making conformers state their position keeps a new language code generator from silently inheriting the Java-specific defaults. `Configuration` (swift-java) now declares both as `false` explicitly. - `SwiftExtractTests`: drop the `.swiftLanguageMode(.v5)` override; the target compiles and runs cleanly under the package's default Swift 6 mode.
1 parent 9964dcf commit 792a9ae

4 files changed

Lines changed: 8 additions & 11 deletions

File tree

Package.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@ let package = Package(
475475
"SwiftExtract",
476476
.product(name: "SwiftSyntax", package: "swift-syntax"),
477477
.product(name: "SwiftParser", package: "swift-syntax"),
478-
],
479-
swiftSettings: [
480-
.swiftLanguageMode(.v5)
481478
]
482479
),
483480

Sources/JExtractSwiftLib/Configuration+SwiftExtract.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ extension Configuration: SwiftExtractConfiguration {
4242
case .critical: return .critical
4343
}
4444
}
45+
46+
// swift-java targets Java, which cannot express Swift operators or
47+
// construct open generic types directly: leave both knobs off
48+
public var extractsOperators: Bool { false }
49+
public var extractsGenericTypeInitializers: Bool { false }
4550
}
4651

4752
extension LogLevel {

Sources/SwiftExtract/SwiftAnalyzer.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import SwiftParser
1919
import SwiftSyntax
2020

2121
/// Drives the analysis of Swift source code into an `AnalysisResult` that
22-
/// downstream language generators (e.g. Java/JNI/FFM, others) can consume
22+
/// downstream language generators can consume.
2323
///
24-
/// The analysis is language-neutral; language-specific extraction rules
24+
/// The analysis output is language-neutral; language-specific extraction rules
2525
/// (such as honoring Java's `@JavaExport` or skipping `@JavaClass`-wrapped
2626
/// types) are layered in via an optional `ExtractDecider`
2727
public final class SwiftAnalyzer {
@@ -157,8 +157,7 @@ extension SwiftAnalyzer {
157157
}
158158

159159
/// Top-level convenience: run analysis on the given Swift sources and return
160-
/// the resulting `AnalysisResult`. Useful for tests and for callers that only
161-
/// need analysis (no code generation).
160+
/// the resulting `AnalysisResult`.
162161
public static func analyze(
163162
sources: [(path: String, text: String)],
164163
moduleName: String,

Sources/SwiftExtract/SwiftExtractConfiguration.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ public protocol SwiftExtractConfiguration {
8787
}
8888

8989
extension SwiftExtractConfiguration {
90-
public var extractsOperators: Bool { false }
91-
92-
public var extractsGenericTypeInitializers: Bool { false }
93-
9490
public var availableImportModules: Set<String> { [] }
9591

9692
public func hasImportedModuleStub(moduleOfNominal moduleName: String) -> Bool {

0 commit comments

Comments
 (0)