Skip to content

remove most error or warning message from parser, let checker do the work #26097

@kbkpbot

Description

@kbkpbot

Describe the feature

As checker has a better view than what parser has, I think remove most error or warning message from parser is a good idea.

Use Case

Some error message issued by parser is hard to debug.
For example, #26030

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

I like the error message like following, and it is much clang like:

/media/HD/github/kbkpbot/v/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

f.v:4:33: And the type `new_header` is registered here :
    2 |
    3 | import net.http
    4 | _ := http.Response{header: http.new_header{} }
      |                                 ~~~~~~~~~~
    5 |

Proposed Solution

Remove as many error check from the parser as possible, let checker do the check work.

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.12 5d6f1a9.740fee1

Environment details (OS name and version, etc.)

V full version V 0.4.12 5d6f1a9.740fee1
OS linux, Ubuntu 24.04.3 LTS
Processor 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Memory 12.22GB/15.51GB
V executable /media/HD/github/kbkpbot/v/v
V last modified time 2025-12-23 23:29:50
V home dir OK, value: /media/HD/github/kbkpbot/v
VMODULES OK, value: /home/mars/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/mars/v/bug/file
Git version git version 2.43.0
V git status weekly.2025.46-277-g740fee11-dirty
.git/config present true
cc version cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
gcc version gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
clang version Ubuntu clang version 18.1.3 (1ubuntu1)
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.39-0ubuntu8.6) 2.39

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

    Feature/Enhancement RequestThis issue is made to request a feature or an enhancement to an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions