Skip to content

Conversation

mediremi
Copy link
Member

@mediremi mediremi commented Aug 22, 2025

Closes #7443

I think the problem of the extra large being included in the interface came from the polymorphic variant's constraints labels being printed (if I'm correctly understanding the purpose of the last value in Otyp_variant).

While the removed code may have been needed for OCaml/Reason syntax, I couldn't find any valid ReScript polymorphic variant syntax that required variant labels/tags to be printed.

@mediremi mediremi changed the title Fix interface creation of functions with upper bounded polymorphic args Fix creating interface for functions with upper bounded polymorphic args Aug 22, 2025
(if non_gen then Doc.text "_" else Doc.nil);
Doc.lbracket;
Doc.indent (Doc.concat [opening; print_out_variant out_variant]);
(match labels with
Copy link
Member Author

Choose a reason for hiding this comment

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

Are there any cases when we do want to print out the variant's labels/tags?

The code just above mentions syntax like [< #A | #B > #X #Y ], but this doesn't seem to be valid ReScript:

let opening =
match (closed, labels) with
| true, None -> (* [#A | #B] *) Doc.soft_line
| false, None ->
(* [> #A | #B] *)
Doc.concat [Doc.greater_than; Doc.line]
| true, Some [] ->
(* [< #A | #B] *)
Doc.concat [Doc.less_than; Doc.line]
| true, Some _ ->
(* [< #A | #B > #X #Y ] *)
Doc.concat [Doc.less_than; Doc.line]
| false, Some _ ->

@mediremi mediremi marked this pull request as ready for review August 22, 2025 10:14
@zth zth requested a review from cristianoc August 22, 2025 10:16
Copy link

pkg-pr-new bot commented Aug 22, 2025

Open in StackBlitz

rescript

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

@rescript/darwin-arm64

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

@rescript/darwin-x64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/win32-x64

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

commit: 02f5001

@mediremi mediremi merged commit 1c9ebd7 into rescript-lang:master Aug 23, 2025
27 checks passed
@mediremi mediremi deleted the invalid-resi-polymorphic branch August 23, 2025 15:20
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.

Invalid .resi generated

2 participants