diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 58f7e4d7a..384ebb2b1 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -412,6 +412,7 @@ impl Eval for CallArgs { }); } CallArg::Spread(expr) => match expr.eval(ctx)? { + Value::None => {} Value::Array(array) => { items.extend(array.into_iter().map(|value| Arg { span, diff --git a/tests/typ/code/spread.typ b/tests/typ/code/spread.typ index f1414313a..4e7e0ad81 100644 --- a/tests/typ/code/spread.typ +++ b/tests/typ/code/spread.typ @@ -50,6 +50,13 @@ test(tostr(a: 1, ..more, b: 2), "(a: 1, c: 3, d: 4, b: 2)") } +--- +// None is spreadable. +#let f() = none +#f(..none) +#f(..if false {}) +#f(..for x in () []) + --- // Error: 8-14 cannot spread string #min(.."nope")