rescript-lang / rescript-lang/rescript

Weird formatting when coercing types with `:>`

Open
#7,175 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

syntax
Dominant language
OCaml
Stars
7.5k
Forks
485
Avg merge
1d 2h
Merged PRs (30d)
55

Description

This line is 105 characters long so it should break before the ->LongModuleName.longFunctionName, but it does not.

(LongModuleName.makeNoParams() :> LongModuleName.subTypeOfLongTypeName)->LongModuleName.longFunctionName

This one breaks between the parameters of the make function:

// Before formatting
(LongModuleName.make(  ~a=1,  ~b="",) :> LongModuleName.subTypeOfLongTypeName)->LongModuleName.longFunctionName

// After formatting
(LongModuleName.make(
  ~a=1,
  ~b="",
) :> LongModuleName.subTypeOfLongTypeName)->LongModuleName.longFunctionName

Playground link

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Playground reproduction and compare the formatter's output for the two coercion examples. The work is done when the 105-character expression breaks before the arrow to longFunctionName rather than between make's parameters, with the existing formatting behavior preserved elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.