Skip to content

BridgeJS: Fix duplicate FeatureFlag enum in EnumRawType test input - #840

Merged
krodak merged 1 commit into
swiftwasm:mainfrom
PassiveLogic:kr/bridgejs-test-input-fixes
Dec 2, 2026
Merged

krodak merged 1 commit into
swiftwasm:mainfrom
PassiveLogic:kr/bridgejs-test-input-fixes

Conversation

@krodak

@krodak krodak commented Dec 2, 2026

Copy link
Copy Markdown
Member

Overview

Split out of the work to continue #808 (moving BridgeJS extraction onto SwiftExtract), so that PR doesn't carry unrelated snapshot churn.

EnumRawType.swift declares two enums named FeatureFlag: the exported @JS enum FeatureFlag: Bool and a plain enum FeatureFlag: String used by the imported takesFeatureFlag / returnsFeatureFlag. The current extractor resolves the name to whichever declaration it registers last, so the exported setFeatureFlag, getFeatureFlag and roundTripOptionalFeatureFlag were snapshotted with the String ABI even though their enum is Bool:

// Before
public func _bjs_setFeatureFlag(_ flagBytes: Int32, _ flagLength: Int32) -> Void
// After
public func _bjs_setFeatureFlag(_ flag: Int32) -> Void

The imported enum is renamed to ImportedFlag and marked @JS, replacing the hand-written _BridgedSwiftEnumNoPayload conformance. A plain enum would leave ImportedFlagTag undeclared in the generated .d.ts; as @JS it gets its declaration and check:bridgejs-dts passes. The imported functions keep the String ABI they had before.

Only the test input and its snapshots change.

@krodak
krodak enabled auto-merge (squash) December 2, 2026 10:31
@krodak
krodak merged commit 33655d3 into swiftwasm:main Dec 2, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants