Skip to content

fix: correct std.repeat error message#906

Merged
stephenamar-db merged 2 commits into
databricks:masterfrom
He-Pin:fix/repeat-error-message
Jun 9, 2026
Merged

fix: correct std.repeat error message#906
stephenamar-db merged 2 commits into
databricks:masterfrom
He-Pin:fix/repeat-error-message

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix std.repeat error message from "makeArray requires size >= 0" to "repeat requires count >= 0"
  • The old message was a copy-paste artifact from std.makeArray

Verification against go-jsonnet

go-jsonnet shows "makeArray requires size >= 0" because its stdlib implements std.repeat in Jsonnet using std.makeArray internally. sjsonnet implements std.repeat as a native builtin, so the error should reference the correct function name that the user called.

Test plan

  • Added golden error test error.repeat_negative_count.jsonnet
  • All existing tests pass

@He-Pin He-Pin force-pushed the fix/repeat-error-message branch from ba251f4 to 3ed4072 Compare June 9, 2026 07:48
builtin("repeat", "what", "count") { (pos, ev, what: Val, count: Int) =>
if (count < 0) {
Error.fail("makeArray requires size >= 0, got " + count)
Error.fail("repeat requires count >= 0, got " + count)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a small typo

@stephenamar-db stephenamar-db merged commit 1bc2fde into databricks:master Jun 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants