vfmt removes Option types in match statements #21076
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: vfmt
Bugs/feature requests, that are related to the `vfmt`, the formatter for V.
Describe the bug
If a sum type has an option type as one of its listed types. In a match statement for that sum type, vfmt removes the
?
from the type and results in the compiler error ofmatch must be exhaustive
.Reproduction Steps
Expected Behavior
For vfmt to keep the
?
in the type name.Current Behavior
currently vfmt produces from the example code
and errors when run with
Foo has no variant Bar
andmatch must be exhaustive (add match branches for: ?Bar or else {} at the end)
Possible Solution
No response
Additional Information/Context
No response
V version
V 9d4ec7b
Environment details (OS name and version, etc.)
OS: linux, "Arch Linux"
Processor: 12 cpus, 64bit, little endian, AMD Ryzen 5 3600X 6-Core Processor
Git version: git version 2.44.0
Git vroot status: weekly.2023.45.1-870-g9d4ec7b5
.git/config present: true
CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
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.
The text was updated successfully, but these errors were encountered: