Skip to content

Calling external with attribute @get of type unit => 'a triggers Assertion failed compiler panic #7676

@mediremi

Description

@mediremi

This issue exists since at least v8.4.2 (the oldest version available in the playground).

The following code triggers error File "compiler/core/lam_compile_external_call.ml", line 424, characters 11-17: Assertion failed:

@get
external foo: unit => string = "foo"

let x = foo()

Playground link

Relevant compiler code:

| Js_get {js_get_name = name; js_get_scopes = scopes} -> (
let args, cur_eff = assemble_args_no_splice arg_types args in
add_eff cur_eff
@@
match args with
| [obj] ->
let obj = translate_scoped_access scopes obj in
E.dot obj name
| _ -> assert false

Not calling foo compiles fine though:

@get
external foo: unit => string = "foo"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions