Skip to content

v12 alpha: incorrect compiler output #7023

Closed
@cknitt

Description

@cknitt

When compiling rescript-schema with v12 alpha.3, I noticed invalid output. Simplified, the problem is this:

In v11, the following ReScript code:

type error

let reason = (error: error, ~nestedLevel as _ = ?): string => String.make(error)
let reason: error => string = Obj.magic(reason)

let message = (error: error) => `Failed reason: ${error->reason}`

compiles to

function reason(error, param) {
  return String(error);
}

function message(error) {
  return "Failed reason: " + reason(error);
}

whereas in v12 alpha, it compiles to the invalid code

function reason(error, param) {
  return String(error);
}

function message(error) {
  return "Failed reason: " + param => reason(error, param);
}

/cc @cristianoc @cometkim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions