Skip to content

Verify that all downcasts are represented by a Cast node #551

Description

@Derppening

Currently, the Wasm backend emits some downcasts of its own rather than fully relying on the presence of a Cast node. This causes:

  • The IR to miss crucial information on when cast should be inserted
  • The Wasm backend's downcast implementation to do more work than is necessary

Preferably, we would like to have Wasm's downcast helper to only cast between nullable and non-null types, since these kinds of casts cannot be represented in the IR.

A WIP implementation is available here: https://github.com/Derppening/mlscript/tree/enhance/more-casts-in-typed-ir. One major issue with the implementation is the large number of explicit Cast that are present in the diff - I suspect enabling typed-annotated let bindings (#547) may address some of this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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