From b16daf7af48144b822b0d302d26906500c6cde20 Mon Sep 17 00:00:00 2001 From: Oscar Spencer Date: Sat, 16 Mar 2024 02:38:36 +0100 Subject: [PATCH] fix(grainfmt): Fix printing of qualified infix operators --- compiler/src/formatting/fmt.re | 8 +++++++- compiler/test/grainfmt/application.expected.gr | 2 ++ compiler/test/grainfmt/application.input.gr | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/src/formatting/fmt.re b/compiler/src/formatting/fmt.re index e5c2293fd..0d2fe4789 100644 --- a/compiler/src/formatting/fmt.re +++ b/compiler/src/formatting/fmt.re @@ -875,7 +875,13 @@ let print_ident_string = (fmt, ident) => }; let print_identifier = (fmt, ident) => { - fmt.print_ident_string(fmt, Identifier.string_of_ident(ident)); + switch (ident) { + | Identifier.IdentName({txt: ident}) => fmt.print_ident_string(fmt, ident) + | IdentExternal(mod_, {txt: ident}) => + fmt.print_identifier(fmt, mod_) + ++ string(".") + ++ fmt.print_ident_string(fmt, ident) + }; }; let print_punnable_expression = (fmt, ({txt: ident, loc: ident_loc}, expr)) => { diff --git a/compiler/test/grainfmt/application.expected.gr b/compiler/test/grainfmt/application.expected.gr index 13ff2e6a0..a80686875 100644 --- a/compiler/test/grainfmt/application.expected.gr +++ b/compiler/test/grainfmt/application.expected.gr @@ -83,3 +83,5 @@ let preExistingObjectsWithRefCountMismatch2 = Map.make(): Number ) > + +Int32.(-)(1l, 2l) diff --git a/compiler/test/grainfmt/application.input.gr b/compiler/test/grainfmt/application.input.gr index 2124f8d5f..84935187c 100644 --- a/compiler/test/grainfmt/application.input.gr +++ b/compiler/test/grainfmt/application.input.gr @@ -50,3 +50,5 @@ let preEmatch = Map.make(): (Map.Map) let preExistingObjectsch2 = Map.make(): (Map.Map) let preExistingObjectsWithRefCountMismatch2 = Map.make(): (Map.Map) + +Int32.(-)(1l, 2l)