mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 05:14:44 +02:00
allow tables in ++ operator (#7051)
This PR closes #6916, which now allows table/table operations on the `++` operator. ``` [[a b]; [1 2]] ++ [[a b]; [1 3]] ╭───┬───┬───╮ │ # │ a │ b │ ├───┼───┼───┤ │ 0 │ 1 │ 2 │ │ 1 │ 1 │ 3 │ ╰───┴───┴───╯ ```
This commit is contained in:
@ -23,7 +23,6 @@ pub fn math_result_type(
|
||||
op: &mut Expression,
|
||||
rhs: &mut Expression,
|
||||
) -> (Type, Option<ParseError>) {
|
||||
//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);
|
||||
(
|
||||
|
Reference in New Issue
Block a user