From abe46f2eaaff76cfeb4a76900d1a1ada4e0691ad Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Tue, 31 May 2022 06:44:56 +0200 Subject: [PATCH 1/2] Issues with outcome printer and arity0 Added a couple of examples. --- tests/oprint/expected/oprint.resi.txt | 2 ++ tests/oprint/oprint.res | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tests/oprint/expected/oprint.resi.txt b/tests/oprint/expected/oprint.resi.txt index 29fbcffa..d007d477 100644 --- a/tests/oprint/expected/oprint.resi.txt +++ b/tests/oprint/expected/oprint.resi.txt @@ -179,6 +179,8 @@ module Js: { } type arity0 = (.) => unit type arity0b = (.) => int +type arity0c = Js.Fn.arity0>> +type arity0d = (. unit) => unit type arity1 = (. int) => int type arity2 = (. int, int) => int type arity3 = (. int, int, int) => int diff --git a/tests/oprint/oprint.res b/tests/oprint/oprint.res index f135c8a4..69a6f135 100644 --- a/tests/oprint/oprint.res +++ b/tests/oprint/oprint.res @@ -232,6 +232,8 @@ module Js = { type arity0 = Js.Fn.arity0 type arity0b = Js.Fn.arity0 +type arity0c = Js.Fn.arity0>> +type arity0d = Js.Fn.arity0 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> @@ -340,3 +342,4 @@ let f = (~x=?, ~y as _) => x type call = CleanStart let f = (~a=1) => 1 + From 612a78a1ad30786a014521fe88d7abf29abbcadb Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Tue, 31 May 2022 12:44:06 +0200 Subject: [PATCH 2/2] Arity 0 is not only for int. Patch from @IwanKaramazow --- src/res_outcome_printer.ml | 6 +++--- tests/oprint/expected/oprint.resi.txt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/res_outcome_printer.ml b/src/res_outcome_printer.ml index bfa10d8c..12503c11 100644 --- a/src/res_outcome_printer.ml +++ b/src/res_outcome_printer.ml @@ -239,12 +239,12 @@ let printPolyVarIdent txt = ] | Otyp_constr ( Oide_dot (Oide_dot (Oide_ident "Js", "Fn") , "arity0"), (* Js.Fn.arity0 *) - [Otyp_constr (Oide_ident ident, [])] (* int or unit or string *) + [typ] ) -> - (* Js.Fn.arity0 -> (.) => int*) + (* Js.Fn.arity0 -> (.) => t *) Doc.concat [ Doc.text "(.) => "; - Doc.text ident; + printOutTypeDoc typ; ] | Otyp_constr ( Oide_dot (Oide_dot (Oide_ident "Js", "Fn") , ident), (* Js.Fn.arity2 *) diff --git a/tests/oprint/expected/oprint.resi.txt b/tests/oprint/expected/oprint.resi.txt index d007d477..9bd7fcb3 100644 --- a/tests/oprint/expected/oprint.resi.txt +++ b/tests/oprint/expected/oprint.resi.txt @@ -179,8 +179,8 @@ module Js: { } type arity0 = (.) => unit type arity0b = (.) => int -type arity0c = Js.Fn.arity0>> -type arity0d = (. unit) => unit +type arity0c = (.) => (.) => array +type arity0d = (.) => unit => unit type arity1 = (. int) => int type arity2 = (. int, int) => int type arity3 = (. int, int, int) => int