Skip to content

BridgeJS: Resolve qualified type references relative to extension scope #805

Description

@krodak

BridgeJS resolves unqualified type references relative to their lexical scope, but qualified relative names such as Shelf.Divider are currently treated as root-qualified.

For example:

@JS class Library {
    @JS struct Shelf {
        @JS struct Divider {
            @JS init() {}
        }
    }
}

extension Library {
    @JS func divider(_ value: Shelf.Divider) -> Shelf.Divider {
        value
    }
}

Swift resolves Shelf.Divider as Library.Shelf.Divider. BridgeJS instead looks for a root-level Shelf.Divider, then silently omits divider(_:) from the generated skeleton.

The same behavior exists before #803, although extension-nested types make it easier to run into. MemberTypeSyntax should search from the innermost lexical scope before falling back to a root-qualified path, matching the existing behavior for IdentifierTypeSyntax.

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