Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtin: add runtime check for []Type{cap: negative} #23307

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

Delta456
Copy link
Member

@Delta456 Delta456 commented Dec 29, 2024

PR similar to #23294 but for cap

Huly®: V_0.6-21739

@JalonSolov
Copy link
Contributor

JalonSolov commented Dec 29, 2024

Separate PR would be fine, but... probably should have a check for init as well, so that

a := []u8{len: 5, init: -1}

is invalid.

a := []u8{len: 5, init: ~0}

would have the same effect, but it is not trying to assign a negative number to an unsigned value.

@spytheman spytheman merged commit 99b93d9 into vlang:master Dec 30, 2024
72 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.

3 participants