Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/tx3-lang/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,11 @@ impl MapConstructor {
let value_type = first_field.value.target_type()?;
Some(Type::Map(Box::new(key_type), Box::new(value_type)))
} else {
None
// Empty map literal: element types are unknown from the literal
// alone. Return a Map with Undefined inner types so the analyzer
// can still treat this as a Map; type coherence is checked by the
// enclosing context (e.g. a struct field of declared Map<K,V> type).
Some(Type::Map(Box::new(Type::Undefined), Box::new(Type::Undefined)))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/tx3-lang/src/tx3.pest
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ map_field = {
}

map_constructor = {
"{" ~ (map_field ~ ",")+ ~ "}"
"{" ~ (map_field ~ ",")* ~ "}"
}

// input block
Expand Down
Loading