rescript-lang / rescript-lang/rescript

The parser does not ignore subsequent open multi-line comment /* inside /** or /*

Open
#7,508 0 comments 1 reaction 1 assignee View on GitHub

@shulhi is already working on this.

Since Jul 23, 2025.

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

Description

Thank you for filing! Check list:

  • Is it a bug? Usage questions should often be asked in the forum instead.
  • Concise, focused, friendly issue title & description.
  • A minimal, reproducible example.
  • OS and browser versions, if relevant.
  • Is it already fixed in master? Instructions

I found an odd case while I was writing some documentation for the MSW bindings I maintain:

/**
Creates a handler that intercepts any HTTP request method for the given URL pattern.

https://mswjs.io/docs/api/http/all

\```rescript
MSW.Http.all(
  #URL("/api/*"), // <- this is the issue
  async ({ request, cookies, params }) => {
    MSW.HttpResponse.text("Intercepted any method", {status: 200})
  }
)
\```
*/

Which produces the following syntax error:

  Syntax error!
  /.../rescript-msw/src/MSW__Http.res:23:1-311:0

   21 │ }
   22 │ 
   23 │ /**
   24 │ Creates a handler that intercepts any HTTP request method for the give
      │ n URL pattern.
    . │ ...
  310 │ ) => MSW__Common.requestHandler = "options"
  311 │ 

  This comment seems to be missing a closing `*/`

As a minimal example:

/**
/*
*/
let hello = "world"

Playground link

This is valid javascript / typescript so I'd expect this to work, and also the error message was a little confusing.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.