Better record types (#350)

This commit is contained in:
JT
2021-11-19 17:30:27 +13:00
committed by GitHub
parent 88988dc9f4
commit ff43ca4d24
3 changed files with 18 additions and 7 deletions

View File

@@ -181,9 +181,12 @@ impl Value {
Value::Date { .. } => Type::Date,
Value::Range { .. } => Type::Range,
Value::String { .. } => Type::String,
Value::Record { cols, vals, .. } => {
Type::Record(cols.clone(), vals.iter().map(|x| x.get_type()).collect())
}
Value::Record { cols, vals, .. } => Type::Record(
cols.iter()
.zip(vals.iter())
.map(|(x, y)| (x.clone(), y.get_type()))
.collect(),
),
Value::List { .. } => Type::List(Box::new(Type::Unknown)), // FIXME
Value::Nothing { .. } => Type::Nothing,
Value::Block { .. } => Type::Block,