Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BridgeJS: Optional @JSClass parameter fails lift/lower for generated bindings #751

Copy link
Copy link
@kateinoigakukun

Description

@kateinoigakukun
Issue body actions

Summary

BridgeJS code generation fails when a @JS exported function takes an optional @JSClass parameter (e.g. JSAbortSignal?).

Repro

In a BridgeJS-exported Swift API:

@JSClass
public struct JSAbortSignal {
    @JSFunction public func addEventListener(type: String, listener: JSTypedClosure<() -> Void>) throws(JSException)
}

@JS
public final class JSCanvasSession {
    @JS
    public func recognizeText(pageId: String, languageCode: String, abortSignal: JSAbortSignal?) async throws(JSException) -> String {
        return "{}"
    }
}

Run BridgeJS AoT generation + build.

Actual

Generated code fails to compile in Generated/BridgeJS.swift with optional lift/lower errors for Optional<JSAbortSignal>, e.g.:

  • no exact matches in call to static method 'bridgeJSLiftParameter'
  • candidates require Wrapped == JSObject or protocol conformances not satisfied by JSAbortSignal

Expected

Optional @JSClass params should be supported, or codegen should emit a clear diagnostic that this shape is unsupported.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.