Skip to content

A @set or @set_index external with a unit value crashes the compiler #9339

Closed

Description

@cknitt

A @set or @set_index external whose value has type unit crashes the compiler.

type t
@set external setX: (t, unit) => unit = "x"
let f = (t: t) => setX(t, ())
Fatal error: exception File "compiler/core/lam_compile_external_call.ml", line 448, characters 11-17: Assertion failed

@set_index external setI: (t, string, unit) => unit = "" crashes the same way (line 464).

A unit argument is left out of the JS call, so the translation gets one argument where it expects two. The same external with an @ignore value is already rejected with Ill defined attribute @set (two args required).

Expected: either the same error at the declaration, or t.x = undefined.

Found while reviewing #9231. Reproduced on master 54b923a.

Activity

  1. added theissue type on Nov 19, 2026
  2. added a commit that references this issue on Nov 22, 2026
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions