diff --git a/cli/src/repl/eval.rs b/cli/src/repl/eval.rs index d1b2461d54..774e3efd76 100644 --- a/cli/src/repl/eval.rs +++ b/cli/src/repl/eval.rs @@ -6,13 +6,8 @@ use roc_gen::{run_jit_function, run_jit_function_dynamic_type}; use roc_module::ident::{Lowercase, TagName}; use roc_module::operator::CalledVia; use roc_module::symbol::{Interns, ModuleId, Symbol}; -<<<<<<< HEAD use roc_mono::layout::{union_sorted_tags_help, Builtin, Layout, UnionVariant}; -use roc_parse::ast::{AssignedField, Expr, StrLiteral, TrailingComma}; -======= -use roc_mono::layout::{Builtin, Layout}; use roc_parse::ast::{AssignedField, Expr, StrLiteral}; ->>>>>>> correctly parse trailing commas in record use roc_region::all::{Located, Region}; use roc_types::subs::{Content, FlatType, Subs, Variable}; use roc_types::types::RecordField; @@ -425,6 +420,7 @@ fn struct_to_ast<'a>( Expr::Record { update: None, fields: output, + final_comments: &[], } } else { debug_assert_eq!(sorted_fields.len(), field_layouts.len()); @@ -460,7 +456,7 @@ fn struct_to_ast<'a>( Expr::Record { update: None, fields: output, - trailing_comma: arena.alloc([]), + final_comments: &[], } } } @@ -617,6 +613,7 @@ fn byte_to_ast<'a>(env: &Env<'a, '_>, value: u8, content: &Content) -> Expr<'a> Expr::Record { update: None, fields: arena.alloc([loc_assigned_field]), + final_comments: &[], } } FlatType::TagUnion(tags, _) if tags.len() == 1 => { diff --git a/compiler/parse/src/parser.rs b/compiler/parse/src/parser.rs index f85d1c865b..f8ff9012fb 100644 --- a/compiler/parse/src/parser.rs +++ b/compiler/parse/src/parser.rs @@ -611,7 +611,7 @@ where D: Parser<'a, ()>, P: Parser<'a, Val>, { - move |arena, state: State<'a>| { + move |arena, state: State<'a>| { match parser.parse(arena, state) { Ok((first_output, next_state)) => { let mut state = next_state; @@ -894,7 +894,8 @@ macro_rules! collection_trailing_sep { $crate::parser::trailing_sep_by0( $delimiter, $crate::blankspace::space0_around($elem, $min_indent) - ), $crate::blankspace::spaces0($min_indent) + ), + $crate::blankspace::spaces0($min_indent) ), $closing_brace ) @@ -1209,7 +1210,8 @@ macro_rules! record { loc!(record_field!($val_parser, $min_indent)), $min_indent ), - ), $crate::blankspace::space0($min_indent) + ), + $crate::blankspace::space0($min_indent) ), $crate::parser::ascii_char(b'}') ) diff --git a/compiler/parse/tests/test_parse.rs b/compiler/parse/tests/test_parse.rs index 40a3fc8c70..82d1818d9d 100644 --- a/compiler/parse/tests/test_parse.rs +++ b/compiler/parse/tests/test_parse.rs @@ -419,6 +419,7 @@ mod test_parse { let expected = Record { fields: &[], update: None, + final_comments: &[], }; let actual = parse_expr_with(&arena, "{}"); @@ -450,6 +451,7 @@ mod test_parse { let expected = Record { update: Some(&*arena.alloc(update_target)), fields, + final_comments: &[], }; let actual = parse_expr_with(&arena, "{ Foo.Bar.baz & x: 5, y: 0 }");