Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Switch PrintType.re to syntax outcome printer. #33

Closed
IwanKaramazow opened this issue Nov 29, 2020 · 2 comments · Fixed by #34
Closed

Switch PrintType.re to syntax outcome printer. #33

IwanKaramazow opened this issue Nov 29, 2020 · 2 comments · Fixed by #34

Comments

@IwanKaramazow
Copy link
Contributor

IwanKaramazow commented Nov 29, 2020

PrintType.re currently uses some custom code to print types. The outcome printer from the syntax repo implements the same functionality: https://github.com/rescript-lang/syntax/blob/master/src/res_outcome_printer.ml and has tests.
To reduce complexity and provide a better printing experience for the user we should switch to the outcome printer of the syntax repo. Types can be converted to the Outcometree with the compiler-libs if I recall correctly.

@amiralies
Copy link
Contributor

Should we use syntax repo as a submodule for this or just vendor desired modules?

@cristianoc
Copy link
Contributor

The missing cases currently fall back to Printtyp.type_expr, which is implemented in the compiler as:

let typexp sch ppf ty =
  !Oprint.out_type ppf (tree_of_typexp sch ty)

let type_expr ppf ty = typexp false ppf ty

So one would use the same logic but replace Oprint.out_type.

cristianoc added a commit that referenced this issue Dec 1, 2020
Fixes #33

- Vendor the ourcome printer from https://github.com/rescript-lang/syntax
- Make monads ppx use 406 AST to compile the vendored code (inline records)
- Pass around / calculate recursion status to correctly print multiple and recursive type definitions.
cristianoc added a commit that referenced this issue Dec 2, 2020
Fixes #33

- Vendor the ourcome printer from https://github.com/rescript-lang/syntax
- Make monads ppx use 406 AST to compile the vendored code (inline records)
- Pass around / calculate recursion status to correctly print multiple and recursive type definitions.
chenglou pushed a commit to chenglou/rescript-editor-support that referenced this issue Apr 24, 2021
Fixes rescript-lang#33

- Vendor the ourcome printer from https://github.com/rescript-lang/syntax
- Make monads ppx use 406 AST to compile the vendored code (inline records)
- Pass around / calculate recursion status to correctly print multiple and recursive type definitions.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants