Skip to content

Embedded compilation issue #104

Description

@ainame

I've got a relatively smaller repro project with elementary-ui.
https://github.com/ainame/elementary-ui-embedded-bug-repro

With this, I see below compilation error when compiling the project with wasm-embedded SDK.

ElementaryUI/Views/Function/_FunctionView.swift:30:14:
error: cannot specialize generic function or default protocol method in this context [#EmbeddedRestrictions]
node.patch(view, tx: &tx)

classes cannot have a non-final, generic method 'runUpdate(tx:)' in embedded Swift
classes cannot have a non-final, generic method 'progressAnimation(tx:)' in embedded Swift
ElementaryUI/Views/Function/_FunctionNode.swift:150:13:
error: classes cannot have a non-final, generic method 'SchedulableFunction' in embedded Swift

Full logs

Details
% make
swift build \
                --swift-sdk swift-6.3.2-RELEASE_wasm-embedded \
                --configuration release \
                --product WebApp
[1/1] Planning build
Building for production...
/path/to/elementary-ui-embedded-bug-repro/.build/checkouts/elementary-ui/Sources/ElementaryUI/Views/Function/_FunctionView.swift:30:14: error: cannot specialize generic function or default protocol method in this context [#EmbeddedRestrictions]
28 |         tx: inout _TransactionContext
29 |     ) {
30 |         node.patch(view, tx: &tx)
   |              `- error: cannot specialize generic function or default protocol method in this context [#EmbeddedRestrictions]
31 |     }
32 | }

<unknown>:0: note: generic specialization called here
<unknown>:0: note: generic specialization called here
<unknown>:0: note: generic specialization called here
<unknown>:0: note: generic specialization called here
<unknown>:0: note: generic specialization called here
<unknown>:0: note: generic specialization called here
/path/to/elementary-ui-embedded-bug-repro/Sources/WebApp/App.swift:7:9: note: generic specialization called here
 5 |   static func main() {
 6 |     let app = Application(RootView())
 7 |     app.mount(in: "#app")
   |         `- note: generic specialization called here
 8 |   }
 9 | }

<unknown>:0: error: classes cannot have a non-final, generic method 'runUpdate(tx:)' in embedded Swift [#EmbeddedRestrictions]
<unknown>:0: error: classes cannot have a non-final, generic method 'progressAnimation(tx:)' in embedded Swift [#EmbeddedRestrictions]
<unknown>:0: error: classes cannot have a non-final, generic method 'init(child:animatedValue:wiredValue:depthInTree:)' in embedded Swift [#EmbeddedRestrictions]
<unknown>:0: error: classes cannot have a non-final, generic method 'deinit' in embedded Swift [#EmbeddedRestrictions]
/path/to/elementary-ui-embedded-bug-repro/.build/checkouts/elementary-ui/Sources/ElementaryUI/Views/Function/_FunctionNode.swift:150:13: error: classes cannot have a non-final, generic method 'SchedulableFunction' in embedded Swift [#EmbeddedRestrictions]
148 | }
149 |
150 | final class SchedulableFunction<
    |             `- error: classes cannot have a non-final, generic method 'SchedulableFunction' in embedded Swift [#EmbeddedRestrictions]
151 |     Value: __FunctionView,
152 |     Child: _Mountable,

<unknown>:0: error: classes cannot have a non-final, generic method 'runUpdate(tx:)' in embedded Swift [#EmbeddedRestrictions]
<unknown>:0: error: classes cannot have a non-final, generic method 'progressAnimation(tx:)' in embedded Swift [#EmbeddedRestrictions]
<unknown>:0: error: classes cannot have a non-final, generic method 'init(child:animatedValue:wiredValue:depthInTree:)' in embedded Swift [#EmbeddedRestrictions]
<unknown>:0: error: classes cannot have a non-final, generic method 'deinit' in embedded Swift [#EmbeddedRestrictions]
/path/to/elementary-ui-embedded-bug-repro/.build/checkouts/elementary-ui/Sources/ElementaryUI/Views/Function/_FunctionNode.swift:150:13: error: classes cannot have a non-final, generic method 'SchedulableFunction' in embedded Swift [#EmbeddedRestrictions]
148 | }
149 |
150 | final class SchedulableFunction<
    |             `- error: classes cannot have a non-final, generic method 'SchedulableFunction' in embedded Swift [#EmbeddedRestrictions]
151 |     Value: __FunctionView,
152 |     Child: _Mountable,

[#EmbeddedRestrictions]: <https://docs.swift.org/compiler/documentation/diagnostics/embedded-restrictions>

make: *** [build] Error 1

Environment

  • OS: macOS 26.5
  • Swift: Apple Swift version 6.3.2 (swift-6.3.2-RELEASE) installed via swiftly
  • Embedded Swift SDK: swift-6.3.2-RELEASE_wasm-embedded
  • elementary-ui: 0.2.3
  • elementary: 0.7.1

Originally reported on Swift WASM discord:
https://discord.com/channels/780838335798706197/973525316272279552/1505722359494086738

Metadata

Metadata

Assignees

No one assigned

    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