Skip to content

Invalid function call in generated output #8153

@alex35mil

Description

@alex35mil
// External binding to global "test"
@val external _test: (string, (unit => unit) => unit) => unit = "test"

// Wrapper function shadows the external's target name
let test = (name, callback) => {
  _test(name, _done => callback())
}

// BUG: This should call global test(), but calls local wrapper instead
let broken = () => {
  _test("async", done => done())
}

Generates:

// Generated by ReScript, PLEASE EDIT WITH CARE


function test(name, callback) {
  globalThis.test(name, _done => callback());
}

function broken() {
  test("async", done => done());
}

export {
  test,
  broken,
}
/* No side effect */

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