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

Error message for duplicate @[flag] enum is confusing #22759

Open
2 tasks
revosw opened this issue Nov 4, 2024 · 0 comments
Open
2 tasks

Error message for duplicate @[flag] enum is confusing #22759

revosw opened this issue Nov 4, 2024 · 0 comments
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).

Comments

@revosw
Copy link

revosw commented Nov 4, 2024

Describe the feature

Minimal reproduction:

// main.v

@[flag]
pub enum Enum {
    a
}

@[flag]
pub enum Enum {
    a
}
v main.v

Compiling main.v results in the error:

main.v:4:44: error: duplicate method `is_empty`, `is_empty` is an enum type built-in method
    2 | pub enum Enum {
    3 |     a
    4 | }
      |  ^
    5 | 
    6 | @[flag]

Use Case

Having clear error messages makes me more productive

Proposed Solution

The error message may be the same as duplicate regular enums, which reads:

main.v:6:1: error: cannot register enum `Enum`, another type with this name exists
    4 | }
    5 | 
    6 | pub enum Enum {
      | ~~~~~~~~~~~~~
    7 |     a
    8 | }

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

V 0.4.8 3108820

Environment details (OS name and version, etc.)

V full version: V 0.4.8 3108820
OS: windows, Microsoft Windows 11 Pro v22631 64-bit
Processor: 12 cpus, 64bit, little endian,

getwd: C:\dev\v\winmd
vexe: C:\dev_tools\v\v.exe
vexe mtime: 2024-11-04 09:25:35

vroot: OK, value: C:\dev_tools\v
VMODULES: OK, value: C:\Users\simen.vmodules
VTMP: OK, value: C:\Users\simen\AppData\Local\Temp\v_0

Git version: git version 2.40.0.windows.1
Git vroot status: weekly.2024.26-746-g3108820d
.git/config present: true

CC version: Error: 'cc' is not recognized as an internal or external command,
operable program or batch file.

thirdparty/tcc status: thirdparty-windows-amd64 b425ac82

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@revosw revosw added the Feature Request This issue is made to request a feature. label Nov 4, 2024
@felipensp felipensp self-assigned this Nov 5, 2024
@felipensp felipensp added Bug This tag is applied to issues which reports bugs. Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones). and removed Feature Request This issue is made to request a feature. labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).
Projects
None yet
Development

No branches or pull requests

2 participants