diff options
| author | Alex Saveau <saveau.alexandre@gmail.com> | 2023-06-09 01:25:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-09 10:25:12 +0200 |
| commit | 61effc350a1d5c6a710ff708ce8184180bd6f7c6 (patch) | |
| tree | 526abb61496045ce7eb044b9369746d01f31ef32 | |
| parent | f62f7624a6f56793d06afeecd16c27ed07621ed8 (diff) | |
Don't type check matrices (#1442)
| -rw-r--r-- | library/src/math/matrix.rs | 6 | ||||
| -rw-r--r-- | tests/ref/math/matrix.png | bin | 10167 -> 25677 bytes | |||
| -rw-r--r-- | tests/typ/math/matrix.typ | 6 |
3 files changed, 9 insertions, 3 deletions
diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs index 84dcfd9b..aaccc332 100644 --- a/library/src/math/matrix.rs +++ b/library/src/math/matrix.rs @@ -93,15 +93,15 @@ pub struct MatElem { let mut width = 0; let values = args.all::<Spanned<Value>>()?; - if values.iter().all(|spanned| matches!(spanned.v, Value::Content(_))) { - rows = vec![values.into_iter().map(|spanned| spanned.v.display()).collect()]; - } else { + if values.iter().any(|spanned| matches!(spanned.v, Value::Array(_))) { for Spanned { v, span } in values { let array = v.cast::<Array>().at(span)?; let row: Vec<_> = array.into_iter().map(Value::display).collect(); width = width.max(row.len()); rows.push(row); } + } else { + rows = vec![values.into_iter().map(|spanned| spanned.v.display()).collect()]; } for row in &mut rows { diff --git a/tests/ref/math/matrix.png b/tests/ref/math/matrix.png Binary files differindex 9e357146..d3d2681c 100644 --- a/tests/ref/math/matrix.png +++ b/tests/ref/math/matrix.png diff --git a/tests/typ/math/matrix.typ b/tests/typ/math/matrix.typ index 514827c3..f65004a7 100644 --- a/tests/typ/math/matrix.typ +++ b/tests/typ/math/matrix.typ @@ -57,3 +57,9 @@ $ a + mat(delim: #none, 1, 2; 3, 4) + b $ --- // Error: 13-14 expected array, found content $ mat(1, 2; 3, 4, delim: "[") $, + +--- +$ mat(B, A B) $ +$ mat(B, A B, dots) $ +$ mat(B, A B, dots;) $ +$ mat(#1, #(foo: "bar")) $ |
