Skip to content

Print :> without wrapping parenthesis #6254

Open
@ryyppy

Description

@ryyppy

Given the following example:

type a = {"name": string, "age": int}

type b = {"name": string}

let v: a = {
  "name": "Anton",
  "age": 35,
}

let foo = (arg: b) => {
  Js.log("Hi" ++ arg["name"])
}

foo(v :> b)

Playground link

When pretty-printing the code, the coercion expression will be wrapped with parentheses: foo((v :> b)).

Expected behavior: It should print the expression the same way as it was defined; only preserve parentheses if the operation was originally wrapped in parentheses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions