You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a @JS struct doesn’t have an initialiser that accepts all of its fields in-order (with the names matching exactly), the generated code fails to compile. In other words, the struct must have an initialiser that matches the signature of the generated memberwise one.
For example, this struct generates code that fails to compile:
@JSpublicstructAnimal{publicvarsize:Sizepublicvarage:Age@JSpublicinit(age:Age, size:Size){self.age = age
self.size = size
}}
extension Animal: _BridgedSwiftStruct {
@_spi(BridgeJS) @_transparent public static func bridgeJSStackPop() -> Animal {
let size = Size.bridgeJSStackPop()
let age = Age.bridgeJSStackPop()
return Animal(size: size, age: age) // error: argument 'age' must precede argument 'size'
}
Possible solutions include diagnosing this more clearly, or maybe the @JS macro could generate its own @_spi(BridgeJS) initialiser?
If a
@JSstruct doesn’t have an initialiser that accepts all of its fields in-order (with the names matching exactly), the generated code fails to compile. In other words, the struct must have an initialiser that matches the signature of the generated memberwise one.For example, this struct generates code that fails to compile:
Possible solutions include diagnosing this more clearly, or maybe the
@JSmacro could generate its own@_spi(BridgeJS)initialiser?