Skip to content

Conversation

@mediremi
Copy link
Member

@mediremi mediremi commented Aug 30, 2025

When creating an interface file with rescript-editor-analysis createInterface SomeFile.res, invalid syntax was being generated for module types containing multiple type constraints.

For example:

let make = (
  type value identity,
  ~id: module(Belt.Id.Comparable with type t = value and type identity = identity),
): t<value, identity> => {
  // ...
}

was being converted to interface:

let make: (~id: module(Belt.Id.Comparable with type identity = 'a with type t = 'b)) => t<'b, 'a>

but with type identity = 'a with type t = 'b is invalid syntax and should have been with type identity = 'a and type t = 'b (notice the second with becomes and).

res_outcome_printer did have existing logic to emit and instead of with, but it relied on a ref counter that was not being incremented.

print_out_type_doc typ;
]
in
incr i;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this incr i, i.contents was always 0

@mediremi mediremi marked this pull request as ready for review August 30, 2025 17:07
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 30, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7825

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7825

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7825

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7825

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7825

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7825

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7825

commit: 70e2791

@mediremi mediremi merged commit 22f68af into rescript-lang:master Aug 31, 2025
25 checks passed
@mediremi mediremi deleted the create-interface-module-multi-types branch August 31, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants