Skip to content

fix(grainfmt): Fix printing of qualified infix operators #2071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion compiler/src/formatting/fmt.re
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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)