Skip to content

[naga/wgsl] For loop initializer cannot be shadowed #8235

@k2d222

Description

@k2d222

This naga/wgsl-in test is incorrect. WGSL spec does not allow shadowing the for initializer in the body. (because both declaration would have the same end-of-scope, the closing }).

fn forLexicalScope(a: f32) {
    for (var a = 0; a < 1; a++) {
        let a = true;  // <-- this is not allowed by WGSL spec.
    } // <-- because this is the end-of-scope of both declarations
    let test: f32 = a;
}

Upstream issue for reference: gpuweb/gpuweb#5024

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions