Skip to content

Imports clobber field names in locally defined structs #88

@Runi-c

Description

@Runi-c
#import dep::{foo, bar}

struct Example {
    bar: u32,
}

fn test() {
    let example = Example(0u);
    foo(example.bar);
}

This code produces this error:

error: invalid field accessor `bar`
  ┌─ shaders/test.wgsl:9:39
  │
9 │     dep::foo(example.bar);
  │                                       ^^^ invalid accessor
  │
  = invalid field accessor `bar`

If I amend the code to not import a symbol named bar, the error goes away. But it took a lot more debugging than I'd have liked to figure out that that's what was happening.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions