Skip to content

[vfmt] format error #25496

@Jengro777

Description

@Jengro777

Describe the bug

Annotation between types, v fmt error

Reproduction Steps

module main

type SumResp = string
	| int
	// | f64
	| map[string]int
	| map[string]bool

v fmt -w .

Expected Behavior

format success

Current Behavior

vmain.v:6:2: error: invalid expression: unexpected token `|`
    4 |     | int
    5 |     // | f64
    6 |     | map[string]int
      |     ^
    7 |     | map[string]bool

Internal vfmt error while formatting file: vmain.v.

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.12 2d33a7f

Environment details (OS name and version, etc.)

V full version V 0.4.12 9a01667.2d33a7f
OS linux, Deepin 25
Processor 6 cpus, 64bit, little endian, Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory 0.28GB/7.6GB
V executable /home/Jengro/.vmr/versions/v_versions/v_latest/v
V last modified time 2025-10-14 07:29:37
V home dir OK, value: /home/Jengro/.vmr/versions/v_versions/v_latest
VMODULES OK, value: /home/Jengro/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/Jengro
Git version git version 2.50.1
V git status weekly.2025.29-470-g2d33a7f2
.git/config present true
cc version cc (Deepin 12.3.0-17deepin15) 12.3.0
gcc version gcc (Deepin 12.3.0-17deepin15) 12.3.0
clang version Deepin clang version 17.0.6 (5deepin5)
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (Debian GLIBC 2.38-6deepin16) 2.38

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.Unit: vfmtBugs/feature requests, that are related to the `vfmt`, the formatter for V.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions