Don't type check matrices (#1442)

This commit is contained in:
Alex Saveau 2023-06-09 01:25:12 -07:00 committed by GitHub
parent f62f7624a6
commit 61effc350a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -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 {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -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")) $