allow list of empty record in repl

This commit is contained in:
Folkert 2021-01-22 20:31:29 +01:00
parent 5d59a32938
commit a4d7e809d2
2 changed files with 8 additions and 0 deletions

View file

@ -305,6 +305,9 @@ fn ptr_to_ast<'a>(
let (tag_name, payload_vars) = tags.iter().next().unwrap();
single_tag_union_to_ast(env, ptr, field_layouts, tag_name.clone(), payload_vars)
}
Content::Structure(FlatType::EmptyRecord) => {
struct_to_ast(env, ptr, &[], &MutMap::default())
}
other => {
unreachable!(
"Something had a Struct layout, but instead of a Record type, it had: {:?}",

View file

@ -199,6 +199,11 @@ mod repl_eval {
expect_success("[]", "[] : List *");
}
#[test]
fn literal_empty_list_empty_record() {
expect_success("[ {} ]", "[ {} ] : List {}");
}
#[test]
fn literal_num_list() {
expect_success("[ 1, 2, 3 ]", "[ 1, 2, 3 ] : List (Num *)");