Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Syntax Bug: Closing parenthesis after inline module  #16

Closed
@jsiebern

Description

@jsiebern

I came across a nasty bug just now. I'm not sure if it's just this specific setup though. Some code of mine compiled fine but didn't work the way I expected. When I checked the JS Code, I found it was missing everything after a certain point (Still, it compiled fine).

I eventually found one closing parenthesis too much after a module definition.
See the following example:

open Ws

let wss = Server.make({port: 82})
let address = wss->Server.address
let log = msg => Js.log(`> Server: ${msg}`)
log(`Running on: ${address.address}:${address.port->string_of_int} (${address.family})`)

module ClientSet = {
  module T = Belt.Id.MakeComparable({
    type t = Client.t;
    let cmp = (a, b) => {
      compare(a->Client.getUniqueId, b->Client.getUniqueId);
    };
  });

  let empty = Belt.Set.make(~id=module (T));


}); // this ")" here, this can even be "))))))))))))))))" and it still compiles without complaint

Js.log("test"); // Is omitted from the compiled JS

Addition: When I run the file through napkinscript.exe -parse ns -print ns, everything after the module closing } gets deleted from it

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions