Revamp the syntax to #[hard(a..b)] and #[soft(a..b)] bounds on node definitions (#4307)

* Revamp the syntax to #[hard(a..b)] and #[soft(a..b)] bounds on node definitions

* Address review feedback: error on empty bounds ranges and remove redundant count clamps

* Fix NaN transform from Repeat Array with a count of 1

* Remove redundant manual clamps already enforced by #[hard(...)] bounds
This commit is contained in:
Keavon Chambers
2026-07-03 18:48:58 -07:00
committed by GitHub
parent 95c1ab81f3
commit f05a644bd9
17 changed files with 341 additions and 197 deletions

View File

@@ -424,7 +424,7 @@ fn string_repeat(
string: String,
/// The number of times the string should appear in the output.
#[default(2)]
#[hard_min(1)]
#[hard(1..)]
count: u32,
/// The string placed between each repetition.
#[default("\\n")]
@@ -436,7 +436,7 @@ fn string_repeat(
) -> String {
let separator = if separator_escaping { unescape_string(separator) } else { separator };
let count = count.max(1) as usize;
let count = count as usize;
let mut result = String::with_capacity((string.len() + separator.len()) * count);
for i in 0..count {