diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-10-10 12:16:28 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-10-10 12:16:28 +0200 |
| commit | f4ed775df073ceeff292810f19ca8d01b054eff1 (patch) | |
| tree | 6f2ebe9215ad210a28bb25e33997a9ce03addcd9 | |
| parent | c0f5cd011f882dd177af988260c8687cab057925 (diff) | |
Make `none` spreadable
| -rw-r--r-- | src/eval/mod.rs | 1 | ||||
| -rw-r--r-- | tests/typ/code/spread.typ | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 58f7e4d7..384ebb2b 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 f1414313..4e7e0ad8 100644 --- a/tests/typ/code/spread.typ +++ b/tests/typ/code/spread.typ @@ -51,6 +51,13 @@ } --- +// None is spreadable. +#let f() = none +#f(..none) +#f(..if false {}) +#f(..for x in () []) + +--- // Error: 8-14 cannot spread string #min(.."nope") |
