Skip to content

weird syntax error, mentioning vlib/net/http/header.v:376 instead of the originating source file, doing _ := http.Response{header: http.new_header{} } #26030

@spytheman

Description

@spytheman
V version: V 0.4.12 1fb9c95, press to see full `v doctor` output
V full version V 0.4.12 90fa8bc.1fb9c95
OS linux, Ubuntu 20.04.6 LTS
Processor 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-3225 CPU @ 3.30GHz
Memory 7.34GB/15.42GB
V executable /home/delian/v/v
V last modified time 2025-12-19 10:28:54
V home dir OK, value: /home/delian/v
VMODULES OK, value: /home/delian/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/delian/v
env VFLAGS "-no-parallel"
Git version git version 2.50.0
V git status weekly.2025.51-29-g5f1a9700
.git/config present true
cc version cc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
gcc version gcc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
clang version Ubuntu clang version 18.1.8 (11~20.04.2)
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 (Ubuntu GLIBC 2.31-0ubuntu9.18) 2.31

What did you do?
./v -g -o vdbg cmd/v && ./vdbg x.v && x

import net.http
_ := http.Response{header: http.new_header{} }

  

What did you see?

vlib/net/http/header.v:376:22: error: invalid expression: unexpected token `)`
  374 | // new_header_from_map creates a Header from key value pairs
  375 | pub fn new_header_from_map(kvs map[CommonHeader]string) Header {
  376 |     mut h := new_header()
      |                         ^
  377 |     h.add_map(kvs)
  378 |     return h

What did you expect to see?

a more sensible error, mentioning the source file, not the imported module (which is syntactically valid)

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.Status: ConfirmedThis 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).

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions