Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

fix formatting

author
Giacomo Cavalieri
committer
Louis Pilfold
date (Jul 17, 2026, 1:49 PM +0100) commit c07aa937 parent e8eb002a change-id kwvkzqvv
+39 -8
+3
CHANGELOG.md
··· 520 520 writing a constructor with a lowercase name. 521 521 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 522 522 523 + - Fixed a bug where guards with comments wouldn't be formatted properly. 524 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 525 + 523 526 - A `gleam@@compile.erl` is no longer left in the build output of 524 527 `gleam compile-package`. 525 528 ([Louis Pilfold](https://github.com/lpil))
+11 -8
format/src/lib.rs
··· 3093 3093 left: &'a UntypedClauseGuard, 3094 3094 right: &'a UntypedClauseGuard, 3095 3095 ) -> Document<'a, 'doc> { 3096 - self.clause_guard_bin_op_side(arena, name, left, left.precedence()) 3097 - .append(arena, BREAKABLE_SPACE_DOCUMENT) 3098 - .append(arena, binop(*name)) 3099 - .append(arena, SPACE_DOCUMENT) 3100 - .append( 3101 - arena, 3102 - self.clause_guard_bin_op_side(arena, name, right, right.precedence() - 1), 3103 - ) 3096 + let left_comments = self.pop_comments(left.location().start); 3097 + let left = self.clause_guard_bin_op_side(arena, name, left, left.precedence()); 3098 + let left = commented(arena, left, left_comments); 3099 + 3100 + let right_comments = self.pop_comments(right.location().start); 3101 + let right = self.clause_guard_bin_op_side(arena, name, right, right.precedence() - 1); 3102 + let right = docvec![arena, binop(*name), SPACE_DOCUMENT, right]; 3103 + let right = commented(arena, right, right_comments); 3104 + 3105 + left.append(arena, BREAKABLE_SPACE_DOCUMENT) 3106 + .append(arena, right) 3104 3107 } 3105 3108 3106 3109 fn clause_guard_bin_op_side(
+25
format/src/tests/guards.rs
··· 52 52 } 53 53 54 54 #[test] 55 + fn commented_operators_in_guard() { 56 + assert_format!( 57 + r#"pub fn main() { 58 + case list.map(codepoints, string.utf_codepoint_to_int) { 59 + [drive, colon, slash] 60 + if { slash == 47 || slash == 92 } 61 + && colon == 58 62 + // Hello 63 + && drive >= 65 64 + && drive <= 90 65 + // This is a comment 66 + || drive >= 97 67 + // And another one 68 + && drive <= 122 69 + -> { 70 + 1 71 + |> 2 72 + } 73 + } 74 + } 75 + "# 76 + ); 77 + } 78 + 79 + #[test] 55 80 fn a_comment_before_a_guard_doesnt_force_it_to_break() { 56 81 assert_format!( 57 82 r#"pub fn main() {