Skip to content

Commit

Permalink
fix(grainfmt): Fix printing of qualified infix operators (#2071)
Browse files Browse the repository at this point in the history
  • Loading branch information
ospencer committed Mar 16, 2024
1 parent 1f8a20d commit c22932d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/src/formatting/fmt.re
Expand Up @@ -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)) => {
Expand Down
2 changes: 2 additions & 0 deletions compiler/test/grainfmt/application.expected.gr
Expand Up @@ -83,3 +83,5 @@ let preExistingObjectsWithRefCountMismatch2 = Map.make():
Number
)
>

Int32.(-)(1l, 2l)
2 changes: 2 additions & 0 deletions compiler/test/grainfmt/application.input.gr
Expand Up @@ -50,3 +50,5 @@ let preEmatch = Map.make(): (Map.Map<Number, (Number,Number,Number,Number)>)
let preExistingObjectsch2 = Map.make(): (Map.Map<Number, (Number,Number)>)

let preExistingObjectsWithRefCountMismatch2 = Map.make(): (Map.Map<Number, (Number,Number,Number,Number,Number,Number,Number,Number,Number,Number,Number)>)

Int32.(-)(1l, 2l)

0 comments on commit c22932d

Please sign in to comment.