Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants