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

Issues with outcome printer and arity0 #512

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/oprint/expected/oprint.resi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ module Js: {
}
type arity0 = (.) => unit
type arity0b = (.) => int
type arity0c = Js.Fn.arity0<Js.Fn.arity0<array<int>>>
type arity0d = (. unit) => unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be something like (. unit) => unit => unit
which btw is not currently possible anyway as it would currently format to (. unit, unit) => unit which is arity 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure currently there's even a syntax that can express the intended type: uncurried function that returns a curried function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly related rescript-lang/rescript#5395
so there might be something wrong already in the compiler when dealing with this case.
That, or there's something wrong just in error reporting (still in the compiler).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After the patch this is now (.) => unit => unit which is still not quite rights as it currently means (. unit, unit) => unit after formatting.
But that's a bigger change for another PR.

type arity1 = (. int) => int
type arity2 = (. int, int) => int
type arity3 = (. int, int, int) => int
Expand Down
3 changes: 3 additions & 0 deletions tests/oprint/oprint.res
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ module Js = {

type arity0 = Js.Fn.arity0<unit>
type arity0b = Js.Fn.arity0<int>
type arity0c = Js.Fn.arity0<Js.Fn.arity0<array<int>>>
type arity0d = Js.Fn.arity0<unit => unit>
type arity1 = Js.Fn.arity1<(int) => int>
type arity2 = Js.Fn.arity2<(int, int) => int>
type arity3 = Js.Fn.arity3<(int, int, int) => int>
Expand Down Expand Up @@ -340,3 +342,4 @@ let f = (~x=?, ~y as _) => x
type call = CleanStart

let f = (~a=1) => 1