Skip to content

Conversation

@kateinoigakukun
Copy link
Member

BridgeJS uses @jsclass to model JS objects as value types, but the macro could be applied to other declaration kinds.

Make @jsclass emit a diagnostic unless it’s attached to a struct, and adjust macro tests accordingly.

… `struct` (`Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift:13`).

- Added new diagnostic message `@JSClass can only be applied to structs.` (`Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift:8`).
- Updated macro expansion tests so `class`/`enum`/`actor` usages now produce diagnostics and no generated members/extensions (`Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift:147`).
- Verified with `swift test --package-path ./Plugins/BridgeJS --filter BridgeJSMacrosTests`.
@kateinoigakukun kateinoigakukun merged commit 987b088 into main Jan 26, 2026
9 checks passed
@kateinoigakukun kateinoigakukun deleted the katei/299b-update-bridgejsm branch January 26, 2026 10:34
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.

3 participants