diff --git a/crates/compiler/builtins/roc/Dict.roc b/crates/compiler/builtins/roc/Dict.roc index dddf993397..1f82705a4e 100644 --- a/crates/compiler/builtins/roc/Dict.roc +++ b/crates/compiler/builtins/roc/Dict.roc @@ -851,7 +851,7 @@ LowLevelHasher := { originalSeed : U64, state : U64 } has [ # TODO hide behind an InternalList.roc module listGetUnsafe : List a, Nat -> a -createLowLevelHasher : { seed ?U64 } -> LowLevelHasher +createLowLevelHasher : { seed ? U64 } -> LowLevelHasher createLowLevelHasher = \{ seed ? 0x526F_6352_616E_643F } -> @LowLevelHasher { originalSeed: seed, state: seed } diff --git a/crates/compiler/fmt/src/annotation.rs b/crates/compiler/fmt/src/annotation.rs index 6ae31b9487..1091b81458 100644 --- a/crates/compiler/fmt/src/annotation.rs +++ b/crates/compiler/fmt/src/annotation.rs @@ -509,6 +509,7 @@ fn format_assigned_field_help<'a, 'buf, T>( buf.spaces(separator_spaces); buf.push('?'); + buf.spaces(1); ann.value.format(buf, indent); } LabelOnly(name) => { diff --git a/crates/compiler/test_syntax/tests/test_fmt.rs b/crates/compiler/test_syntax/tests/test_fmt.rs index c00627dcc8..8dd02e681b 100644 --- a/crates/compiler/test_syntax/tests/test_fmt.rs +++ b/crates/compiler/test_syntax/tests/test_fmt.rs @@ -2164,6 +2164,43 @@ mod test_fmt { ); } + #[test] + fn type_definition_add_space_around_optional_record() { + expr_formats_to( + indoc!( + r#" + f : { a ?Str } + + f"# + ), + indoc!( + r#" + f : { a ? Str } + + f"# + ), + ); + + expr_formats_to( + indoc!( + r#" + f : { + a ?Str, + } + + f"# + ), + indoc!( + r#" + f : { + a ? Str, + } + + f"# + ), + ); + } + #[test] #[ignore] fn final_comment_in_empty_record_type_definition() {