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

resolve ** and ++ operators #2105

Closed
Techatrix opened this issue Dec 9, 2024 · 0 comments · Fixed by #2130
Closed

resolve ** and ++ operators #2105

Techatrix opened this issue Dec 9, 2024 · 0 comments · Fixed by #2130
Labels
bug Something isn't working good first issue Good for newcomers priority:low Low priority item

Comments

@Techatrix
Copy link
Member

The following operands are allowed for ** and ++:

  • array e.g. [1]u8{' '}
  • single item pointer to array e.g. &[1]u8{' '}
  • string literal a.k.a single item pointer to array e.g. " "
  • tuple e.g. .{' '}
  • a single item pointer to tuple e.g. &.{' '} Not permitted by Zig even though it is "indexable" with comptime known length
  • comptime known slice e.g. @as([]const u8, " ")

To those who are interested in taking on this issue, some of the above cases are not easily implemented. It is recommended to only handle arrays and single item pointers to arrays excluding string literals. All other types are currently not easily handled in ZLS's analysis backend. The implementation would need to be added to resolveTypeOfNode.

For information on what these operators do, refer to the Zig Language Reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers priority:low Low priority item
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant