Skip to content

Document misplaced rest arguments#1447

Merged
nex3 merged 1 commit intomainfrom
misplaced-rest
Aug 25, 2025
Merged

Document misplaced rest arguments#1447
nex3 merged 1 commit intomainfrom
misplaced-rest

Conversation

@nex3
Copy link
Contributor

@nex3 nex3 commented Aug 23, 2025

@nex3 nex3 requested a review from Goodwine August 23, 2025 01:44
@netlify
Copy link

netlify bot commented Aug 23, 2025

Deploy Preview for sass-lang ready!

Name Link
🔨 Latest commit 9da2f54
🔍 Latest deploy log https://app.netlify.com/projects/sass-lang/deploys/68a91d0db5d9e100086fa0f2
😎 Deploy Preview https://deploy-preview-1447--sass-lang.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.


However, due to an oversight in the implementation of both Ruby Sass and Dart
Sass, this was never enforced. It was possible to write a function call like
`rgb([1, 2]..., 3)` with the rest argument before a positional (or named)
Copy link
Member

Choose a reason for hiding this comment

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

Just out of curiosity I tried passing 2 lists with ... and I do get an error, but it's not very descriptive.

Plain CSS functions don't support keyword arguments.
  ╷
4 │   b: g([1, 2]..., [3, 4]...)

Maybe this is fine, but I just wanted to let you know. This is definitely outside of the scope of the current fix anyways

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two lists is intentionally supported, so that you can write something like rgb([1, 2]..., (blue: 3)...). If you want to take a crack at making the error message more descriptive if the second argument isn't a map, go for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Goodwine the error in your code snippet is because you used g() instead of the name of a Sass function. The error you get is unrelated to the current deprecation (it is related to the restriction of calls for CSS functions).

@nex3 nex3 merged commit 23d43b2 into main Aug 25, 2025
13 checks passed
@nex3 nex3 deleted the misplaced-rest branch August 25, 2025 21:11
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.

3 participants