-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Invalid generic return type syntax is not caught and causes side effects #26520
Copy link
Copy link
Closed
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.This bug has been confirmed to be valid by a contributor.Unit: ParserBugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).Unit: vfmtBugs/feature requests, that are related to the `vfmt`, the formatter for V.Bugs/feature requests, that are related to the `vfmt`, the formatter for V.
Description
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.This bug has been confirmed to be valid by a contributor.Unit: ParserBugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).Unit: vfmtBugs/feature requests, that are related to the `vfmt`, the formatter for V.Bugs/feature requests, that are related to the `vfmt`, the formatter for V.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Describe the bug
The compiler fails to catch an incorrect syntax for generic return types. Using
[T]instead ofTas a return type results in acgen errorand incorrect code rewriting when usingv fmt.Reproduction Steps
Create a file named
main.vand then runv run main.v:Expected Behavior
A syntax error should be emitted.
Current Behavior
v run main.vproduces a low-level C generation error instead of a syntax error:v fmt -w main.vtransforms the function signature into invalid code:voidto the brackets.Possible Solution
No response
Additional Information/Context
No response
V version
V 0.5.0
Environment details (OS name and version, etc.)
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.