Skip to content

[wgsl-in] Parse error for subtraction in array index #4435

@fintelia

Description

@fintelia

This shader:

var<workgroup> a: array<u32, 64>;

fn foo() {
    let x = 1;
    let y = a[x-1];
}

Produces this error:

error: expected ']', found '-1'
  ┌─ a.wgsl:6:16
  │
6 │     let y = a[x-1];
  │                ^^ expected ']'

Could not parse WGSL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions