mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +03:00
Merge pull request #5012 from lucacervello/add-spaces-around-optional-record-field
Add spaces around ? in optional record field
This commit is contained in:
commit
d1a22316fc
@ -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 }
|
||||
|
||||
|
@ -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) => {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user