mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Fix hint for destructuring to an array with at least 1 element (#5154)
This commit is contained in:
parent
1d2a222818
commit
037c0c8216
@ -195,6 +195,7 @@ fn wrong_number_of_elements(
|
||||
|
||||
let quantifier = if len > count { "too many" } else { "not enough" };
|
||||
let expected = match (spread, count) {
|
||||
(true, 1) => "at least 1 element".into(),
|
||||
(true, c) => eco_format!("at least {c} elements"),
|
||||
(false, 0) => "an empty array".into(),
|
||||
(false, 1) => "a single element".into(),
|
||||
|
@ -137,6 +137,11 @@
|
||||
// Hint: 6-20 the provided array has a length of 2, but the pattern expects at least 3 elements
|
||||
#let (..a, b, c, d) = (1, 2)
|
||||
|
||||
--- destructuring-let-array-too-few-elements-with-sink-1-element ---
|
||||
// Error: 6-14 not enough elements to destructure
|
||||
// Hint: 6-14 the provided array has a length of 0, but the pattern expects at least 1 element
|
||||
#let (..a, b) = ()
|
||||
|
||||
--- destructuring-let-array-bool-invalid ---
|
||||
// Error: 6-12 cannot destructure boolean
|
||||
#let (a, b) = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user