diff --git a/crates/nu-command/tests/commands/math/mod.rs b/crates/nu-command/tests/commands/math/mod.rs index c7c8e88b29..1e705fe87b 100644 --- a/crates/nu-command/tests/commands/math/mod.rs +++ b/crates/nu-command/tests/commands/math/mod.rs @@ -509,3 +509,14 @@ fn adding_value_and_list() { assert_eq!(actual.out, "[1, 3, 5]"); } + +#[test] +fn adding_tables() { + let actual = nu!( + cwd: "tests/fixtures/formats", pipeline( + r#" + [[a b]; [1 2]] ++ [[4 5]; [10 11]] | to nuon + "# + )); + assert_eq!(actual.out, "[{a: 1, b: 2}, {4: 10, 5: 11}]"); +} diff --git a/crates/nu-parser/src/type_check.rs b/crates/nu-parser/src/type_check.rs index 9655321f21..b555859f28 100644 --- a/crates/nu-parser/src/type_check.rs +++ b/crates/nu-parser/src/type_check.rs @@ -23,7 +23,6 @@ pub fn math_result_type( op: &mut Expression, rhs: &mut Expression, ) -> (Type, Option) { - //println!("checking: {:?} {:?} {:?}", lhs, op, rhs); match &op.expr { Expr::Operator(operator) => match operator { Operator::Math(Math::Plus) => match (&lhs.ty, &rhs.ty) { @@ -84,6 +83,7 @@ pub fn math_result_type( (Type::List(Box::new(Type::Any)), None) } } + (Type::Table(a), Type::Table(_)) => (Type::Table(a.clone()), None), _ => { *op = Expression::garbage(op.span); (