Skip to content

Don't expand numbers in non-structured arguments#6135

Merged
aryairani merged 5 commits intotrunkfrom
cp/number-expansion-fix
Jan 26, 2026
Merged

Don't expand numbers in non-structured arguments#6135
aryairani merged 5 commits intotrunkfrom
cp/number-expansion-fix

Conversation

@ChrisPenner
Copy link
Member

@ChrisPenner ChrisPenner commented Jan 22, 2026

Overview

There's no reason to expand numerical arguments if the argument type doesn't expect a structured input;
This avoids the need to quote numbers when passing them to things like run.

See @stew 's experience:

gary/main> run getArgs here are four args

  ["here", "are", "four", "args"]

gary/main> run getArgs here are "4" args 
gary/main> run getArgs here are 4 args

  ["here", "are", "4", "args"]

gary/main> run getArgs here are 4 args

  Internal error: Expected a String, but got a structured argument instead.

NEW behaviour

scratch/getargs> run getArgs here are four args

  ["here", "are", "four", "args"]

scratch/getargs> run getArgs here are "4" args
scratch/getargs> run getArgs here are 4 args

  ["here", "are", "4", "args"]

scratch/getargs> run getArgs here are 4 args

  ["here", "are", "4", "args"]

Implementation approach and notes

Check if the argument expects structured arguments, if not, don't expand numbers.

Test coverage

  • updated transcript

@ChrisPenner ChrisPenner marked this pull request as ready for review January 22, 2026 21:51
@ChrisPenner ChrisPenner requested a review from aryairani January 22, 2026 21:52
Copy link
Contributor

@aryairani aryairani left a comment

Choose a reason for hiding this comment

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

Transcript looks much nicer 👍

@ChrisPenner ChrisPenner added the ready-to-merge Apply this to a PR and it will get merged automatically once CI passes and 1 reviewer has approved label Jan 23, 2026
@aryairani aryairani merged commit 60b9ccd into trunk Jan 26, 2026
31 checks passed
@aryairani aryairani deleted the cp/number-expansion-fix branch January 26, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Apply this to a PR and it will get merged automatically once CI passes and 1 reviewer has approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants