zls icon indicating copy to clipboard operation
zls copied to clipboard

resolve `**` and `++` operators

Open techatrix opened this issue 1 year ago • 0 comments

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.

techatrix avatar Dec 09 '24 18:12 techatrix