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

Emit compile error if a match arm variable is declared more than once #5085

Merged
merged 16 commits into from Sep 6, 2023

Conversation

ironcev
Copy link
Member

@ironcev ironcev commented Sep 4, 2023

Description

This PR:

  • addresses the comments given in this PR
  • shows errors if a match arm variable is defined multiple times

The issue is still shown in the header and the wording can be simplified. This will be done in a separate PR, for all existing diagnostics, as shown here.

Closes #4963.

Demo

image

image

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@ironcev ironcev added compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: ui Mostly compiler messages compiler: static-analysis labels Sep 4, 2023
@ironcev ironcev requested review from a team September 4, 2023 10:47
@ironcev ironcev self-assigned this Sep 4, 2023
@ironcev ironcev changed the title Emit compile error if a match arm variable is declared more than once (#4963) Emit compile error if a match arm variable is declared more than once Sep 4, 2023
tritao
tritao previously approved these changes Sep 5, 2023
Copy link
Contributor

@tritao tritao left a comment

Choose a reason for hiding this comment

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

Lgtm aside from some minor typos

anton-trunov and others added 2 commits September 6, 2023 15:04
Co-authored-by: João Matos <joao@tritao.eu>
ironcev and others added 3 commits September 6, 2023 13:22
Co-authored-by: João Matos <joao@tritao.eu>
Co-authored-by: João Matos <joao@tritao.eu>
Co-authored-by: João Matos <joao@tritao.eu>
@ironcev ironcev merged commit 9dc4422 into master Sep 6, 2023
32 checks passed
@ironcev ironcev deleted the ironcev/4963-error-match-arm-variable-already-defined branch September 6, 2023 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: static-analysis compiler: ui Mostly compiler messages compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit compile error if a match arm variable is declared more than once in the same pattern
3 participants