Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

[wgsl-in] Error on param redefinition #2342

Merged
merged 2 commits into from
May 25, 2023

Conversation

SparkyPotato
Copy link
Contributor

@SparkyPotato SparkyPotato commented May 15, 2023

Previously,

fn x(a: f32, a: vec2<f32>) {}

was silently accepted by naga, binding the second parameter to a.

Now, it errors with

error: redefinition of `a`
  ┌─ ..\naga tests\wgsl.wgsl:1:61fn x(a: f32, a: vec2<f32>) {}
  │      ^       ^ redefinition of `a`
  │      │
  │      previous definition of `a`

@teoxoy
Copy link
Member

teoxoy commented May 17, 2023

Thanks for the PR; it looks good!

I think this would fix #2312 as well; would you mind adding one more test case for it?

@SparkyPotato
Copy link
Contributor Author

Thanks for the PR; it looks good!

I think this would fix #2312 as well; would you mind adding one more test case for it?

The issue there was that we were pushing a scope for the arguments, and then another for the block. I fixed that by not using self.block, and commenting the reason why so we don't end up with a regression during future refactoring.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants