diff --git a/analysis/tests/src/Hover.res b/analysis/tests/src/Hover.res index 8a4075084..2da1a17fd 100644 --- a/analysis/tests/src/Hover.res +++ b/analysis/tests/src/Hover.res @@ -111,4 +111,22 @@ let typeDuplicate = AA.fnnxx // ^hov @live let dd = 34 -// ^hov \ No newline at end of file +// ^hov + +let arity0a = (. ()) => { + //^hov + let f = () => 3 + f +} + +let arity0b = (. (), . ()) => 3 +// ^hov + +let arity0c = (. (), ()) => 3 +// ^hov + +let arity0d = (. ()) => { + // ^hov + let f = () => 3 + f +} diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 2824a102a..afc35fb6a 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -70,3 +70,15 @@ Attribute id:live:[112:0->112:5] label:live Completable: Cdecorator(live) {"contents": "The `@live` decorator is for reanalyze, a static analysis tool for ReScript that can do dead code analysis.\n\n`@live` tells the dead code analysis that the value should be considered live, even though it might appear to be dead. This is typically used in case of FFI where there are indirect ways to access values. It can be added to everything that could otherwise be considered unused by the dead code analysis - values, functions, arguments, records, individual record fields, and so on.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#live-decorator).\n\nHint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!"} +Hover tests/src/Hover.res 115:4 +{"contents": "```rescript\n(.) => unit => int\n```"} + +Hover tests/src/Hover.res 121:4 +{"contents": "```rescript\n(.) => (.) => int\n```"} + +Hover tests/src/Hover.res 124:4 +{"contents": "```rescript\n(. unit, unit) => int\n```"} + +Hover tests/src/Hover.res 127:5 +{"contents": "```rescript\n(.) => unit => int\n```"} + diff --git a/analysis/vendor/res_outcome_printer/res_outcome_printer.ml b/analysis/vendor/res_outcome_printer/res_outcome_printer.ml index f88a15c4e..12503c115 100644 --- a/analysis/vendor/res_outcome_printer/res_outcome_printer.ml +++ b/analysis/vendor/res_outcome_printer/res_outcome_printer.ml @@ -233,20 +233,18 @@ let printPolyVarIdent txt = ) | Otyp_alias (typ, aliasTxt) -> Doc.concat [ - Doc.lparen; printOutTypeDoc typ; Doc.text " as '"; - Doc.text aliasTxt; - Doc.rparen + Doc.text aliasTxt ] | 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; + Doc.text "(.) => "; + printOutTypeDoc typ; ] | Otyp_constr ( Oide_dot (Oide_dot (Oide_ident "Js", "Fn") , ident), (* Js.Fn.arity2 *) @@ -352,7 +350,7 @@ let printPolyVarIdent txt = let i = ref 0 in let package = Doc.join ~sep:Doc.line ((List.map2 [@doesNotRaise]) (fun lbl typ -> Doc.concat [ - Doc.text (if i.contents > 0 then "and type " else "with type "); + Doc.text (if i.contents > 0 then "and " else "with "); Doc.text lbl; Doc.text " = "; printOutTypeDoc typ;