Skip to content

Conversation

krodak
Copy link
Contributor

@krodak krodak commented Aug 26, 2025

Issue

Currently for functions that would be using nested types like:

@JS func echoNetworkingAPIMethod(_ method: Networking.API.Method) -> Networking.API.Method {  }

We'd get following error:

error: Unsupported type: Networking.API.Method
Hint: Only primitive types and types defined in the same module are allowed

Issue is that currently lookupType(for only handles IdentifierTypeSyntax, hence MemberTypeSyntax like Networking.API.Method would not be resolved to a valid declaration.

Fix

Centralized type resolution in TypeDeclResolver with a new resolve(_: TypeSyntax) API and used it in ExportSwift to map nested enums/classes/actors to BridgeType. This should help with nested types resolution, while exported ABI remains unchanged for already-supported types.
New tests were added to prelude.mjs to confirm the fix.

@krodak krodak requested a review from kateinoigakukun August 26, 2025 11:49
@krodak krodak self-assigned this Aug 26, 2025
Copy link
Member

@kateinoigakukun kateinoigakukun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kateinoigakukun kateinoigakukun merged commit cb337e7 into swiftwasm:main Aug 26, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants