Skip to content

[BridgeJS] Optionals cause build error with Embedded Swift #689

@sliemeobn

Description

@sliemeobn

Optionals seem broken when built for Embedded (with recent 6.3 Embedded SDK)

eg:

@JSSetter public func setTextContent(_ value: String?) throws(JSException)
// or
@JSSetter public func setOnfinish(_ callback: JSObject?) throws(JSException)

build fine for "full Swift" but fail to compile for Embedded

/Users/simon/dev/elementary-swift/elementary-ui/Sources/BrowserInterop/Generated/BridgeJS.swift:411:29: error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
 409 |         throw error
 410 |     }
 411 |     return Optional<String>.bridgeJSLiftReturnFromSideChannel()
     |                             `- error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
 412 | }
 413 | 

/Users/simon/dev/elementary-swift/elementary-ui/Sources/BrowserInterop/Generated/BridgeJS.swift:642:29: error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
 640 |         throw error
 641 |     }
 642 |     return Optional<String>.bridgeJSLiftReturnFromSideChannel()
     |                             `- error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
 643 | }
 644 | 

/Users/simon/dev/elementary-swift/elementary-ui/Sources/BrowserInterop/Generated/BridgeJS.swift:1047:52: error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
1045 | func _$JSAnimation_onfinish_set(_ self: JSObject, _ newValue: JSObject?) throws(JSException) {
1046 |     let selfValue = self.bridgeJSLowerParameter()
1047 |     let (newValueIsSome, newValueValue) = newValue.bridgeJSLowerParameter()
     |                                                    `- error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
1048 |     bjs_JSAnimation_onfinish_set(selfValue, newValueIsSome, newValueValue)
1049 |     if let error = _swift_js_take_exception() {

/Users/simon/dev/elementary-swift/elementary-ui/Sources/BrowserInterop/Generated/BridgeJS.swift:1557:29: error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
1555 |         throw error
1556 |     }
1557 |     return Optional<String>.bridgeJSLiftReturnFromSideChannel()
     |                             `- error: cannot use conformance of 'Optional<Wrapped>' to '_BridgedAsOptional' here; the conformance is declared as SPI in 'JavaScriptKit'
1558 | }
1559 |

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions