diff --git a/compiler/src/formatting/fmt.re b/compiler/src/formatting/fmt.re index d384c0b82..adf8bb919 100644 --- a/compiler/src/formatting/fmt.re +++ b/compiler/src/formatting/fmt.re @@ -2696,7 +2696,18 @@ let print_type = (fmt, {ptyp_desc, ptyp_loc}) => { ) ++ break, ) - | PTyArrow([{ptyp_arg_label: Unlabeled} as param], return) => + | PTyArrow( + [ + { + ptyp_arg_label: Unlabeled, + ptyp_arg_type: { + ptyp_desc: + PTyAny | PTyVar(_) | PTyArrow(_, _) | PTyConstr(_, []), + }, + } as param, + ], + return, + ) => fmt.print_parsed_type_argument(fmt, param) ++ string(" =>") ++ fmt.print_comment_range( diff --git a/compiler/test/grainfmt/lambda.expected.gr b/compiler/test/grainfmt/lambda.expected.gr index 1953857e9..56c906729 100644 --- a/compiler/test/grainfmt/lambda.expected.gr +++ b/compiler/test/grainfmt/lambda.expected.gr @@ -9,6 +9,9 @@ y => { let z = 2 } +// Regression #2229 +let foo: ((a, b)) => Void = a => void + let testfna = forEachCodePoint(c => /* arg */ void) let testfn = forEachCodePoint(c => /* arg */ { diff --git a/compiler/test/grainfmt/lambda.input.gr b/compiler/test/grainfmt/lambda.input.gr index aa1e62f75..9b0e172f1 100644 --- a/compiler/test/grainfmt/lambda.input.gr +++ b/compiler/test/grainfmt/lambda.input.gr @@ -7,6 +7,9 @@ y => { let z = 2 } +// Regression #2229 +let foo: ((a, b)) => Void = a => void + let testfna = forEachCodePoint(c /* arg */ => void) let testfn = forEachCodePoint(c /* arg */ => {