Releases: vlang/v
Releases · vlang/v
weekly.2025.14
releases: weekly.2025.14
weekly.2025.13
releases: weekly.2025.13
0.4.10
V 0.4.10
20 Mar 2025
Improvements in the language
Breaking changes
- Make old
[attr]
syntax an error (@[attr]
has to be used instead) - builtin:
string.index_after()
now returns an Option (likestring.index()
), usestring.index_after_()
for the old behavior - Vweb is now deprecated in favor of faster and more stable and easy to use veb
Checker improvements/fixes
- Allow
none
to be passed to?T
param (fix #23381) (#23385) - Fix
for
iterator method.next()
, not marked as used (fix #23312) (#23321) - Fix generic var inferring to be passed to
[]T
(fix #23315) (#23322) - Clean up and optimise infix - reduce
as
casting (#23327) - Fix structinit validation on nested generic Map[K]V (fix #23329) (#23332)
- Fix comptime indexexpr resolving (#23333)
- Fix comptime evaluation on infix expr (fix #23341) (#23344)
- Fix alias to fixed array w/ size defined by constant (fix #23356) (#23357)
- Fix missing option variable checking when casting using
as
operator (fix #23349) (#23358) - Fix assign expected type on rechecking enum assigns (fix #23366) (#23367)
- Allow calling
foo(?i64(123))
forfn foo(x ?I64) {
andtype I64 = i64
(#23373) - Cache
node.args[0]
onfixed_array_builtin_method_call
andarray_builtin_method_call
(#23411) - Fix missing check for invalid prefixexpr expression
&(&var)
(fix #23365) (#23418) - Disallow
&((&a))
and similar expressions, with innermostast.PrefixExpr
(enhance #23418) (#23419) - Fix call with mut arg with different pointer levels (fix #23157) (#23428)
- Fix missing detection for
return
in lockexpr stmts (fix #23434) (#23435) - Do not allow auto reference of voidptr params
- Check if unwrapped
m[key]
if m isOption
(fix #23446) (#23459) - Builtin,checker: remove
@[markused]
fromfn isnil()
, setc.table.used_features.auto_str_ptr = true
instead (#23464) - Fix checker generic alias type (fix #23474) (#23475)
- Fix missing check for
a := [none]
(fix #23457) (#23504) - Fix missing check for concrete type on match branch expr (fix #23506) (#23508)
- Fix missing check for invalid argument for builtin (fix #23511) (#23515)
- Fix selector nested unwrapping (fix #23519) (#23521)
- Fix message with old attr syntax (#23529)
- Cache repeated
node.args.len
,method.generic_names.len
,node.concrete_types.len
andnode.op.str()
(#23536) - Disallow
expr is Type
if expr is Optional (fix #23486) (#23510) - Make
option_var.str()
an error, when done without unwrapping it first (fix #23557, fix #23558) (#23563) - Fix private symbol visibility checking (fix #23518) (#23543)
- Disallow constant modification on unsafe {} (#23588)
- Fix sumtype variant option type mismatch (#23659)
- Disallow
arr = voidptr(0)
(fix #23675) (#23687) - Allow for
module no_main
programs, that can redefine their own main function, or not define any of their own as well - Fix match branch checking of nonreturn call on last expr (fix #23698) (#23699)
- Check and error for invalid utf8 string literals (#23721)
- Fix call from unknown enum (fix #23728) (#23730)
- Add checker for passing multi return as arg to func that expects less param (fix #23735) (#23744)
- Fix spreed operator ref field validation (fix #23759) (#23760)
- Fix missing check for method that returns veb.Result (fix #23647) (#23762)
- Allow generic operators to be called in fn (fix #23773) (#23774)
- Fix missing struct cast validation (fix #23748) (#23788)
- Fix map when casting to interface (fix #23790) (#23799)
- Allow for
pub type C.HINSTANCE = voidptr
, being used in@[export: "wWinMain"] fn mymain(x C.HINSTANCE, xprev C.HINSTANCE, lpcmdline &C.WCHAR, cmdshow int) int {
inmodule no_main
programs (#23812) - Add option type inference on if expr (implement most of #23827, except the error for
v := if c { none } else { none }
) (#23829) - Add missing check for IfExpr and MatchExpr with no valid type (#23832)
- Fix MatchExpr type inferring, when
none
is used (fix #23831) (#23833) - Add missing check for generic fntype type names (fix #23453) (#23850)
- Add checking for comptime assign without comptime if checking (fix #23796) (#23848)
- Fix option ptr field assign checking (fix #23879) (#23880)
- Add missing
any
type validation on assignment (fix #23905) (#23906) - Add fntype casting validations (#23872)
- Fix signed integer literal overflow error, when most significant bit occupies signed bit (fix #23782) (#23919)
- Add missing check for casting generic type to literal values (#23915)
- Check if next() method infers generic type correctly (fix #23927) (#23932)
- Disallow references to constants (fix #23935) (#23942)
- Fix typeof evaluation for generic reference (fix #23951) (fix #23952) (#23958)
Parser improvements
- Reduce allocations in empty_comptime_const_expr (#23324)
- Add error for array init of Results
[]!type{}
(fix #23360) (#23375) - Allow map cast syntax
map[k]v(expr)
(#23401) - Inline some commonly used fns (#23535)
- Fix anon fn return type option/result followed by comment parsing in vfmt mode (fix #23607) (#23608)
- Keep track of the number of all scanned tokens too, and show it with
-stats
- Fix the error message position, for a
struct Abc
, that lacks a body (#23627) - Prevent unused warning on
import mod { Sym }
, whenSym
is later used, for more cases (fix #23412) (#23626) - Add support for
-d trace_parse_file_path_and_mod
, to help diagnosing module lookup problems - Allow for
@[has_globals]
to be used for all V programs, turn the@[wasm_import_namespace]
error into a notice - Remove table dep for script main check
- Fix enum value parsing inside array initialization (fix #23937) (#23941)
- Fix the registration of fixed arrays, when size_expr is a const (fix #23946) (#23949)
- Disallow invalid expr in comptime
$for
(fix #23953) (#23959)
Compiler internals
- markused: fix
-skip-unused
on a short program, that prints array (fix #23436) (#23437) - markused: fix
eprintln(err)
on imported module on short program (related: #23498) (#23499) - markused: fix markused auto str detection (fix #23501) (#23503)
- markused: fix option ptr printing (fix #23559) (#23562)
- checker,markused: add identification for sumtype.type_name() call (fix #23732) (#23739)
- markused: improve stability (avoid runtime crash) when processing generic functions (partial fix for #23927)
- markused: fix markused behavior on array / map index getter / setter / slice (#23931)
- markused: fix markused behavior on struct field's default expression (fix #23909) (#23933)
- builder: do not search for msvc when it is not needed (#23386)
- pref: stop parsing CLI options, on encountering
--
(#23470) - util: show
unknown command
suggestions, for more misspelled variants, likev sefl
; make util.new_suggestion calls parametrizable - pref: add Preferences.vroot_file/1 (done here, without using it, to ease the bootstrapping of the cheaders extraction, that will follow next)
- pref: fix panic in parse_args_and_show_errors, called with no args (fix #23713) (#23794)
- pref: allow for
-os wasm32_emscripten
and filtering_d_wasm32_emscripten.c.v
and_notd_wasm32_emscripten.c.v
files. (#23797) - v.builder: show the last line of the C compiler output, in case of errors, in addition to the truncated first lines (the last line is useful, since it usually has an error counter)
- os,v.transformer: fix warnings for
./v -os cross -o vc/v.c cmd/v && clang-18 -o v_from_vc vc/v.c -lpthread
- util: fix stack overflow during parsing of
#flag -DName=$d(...)
(#23895) - builder: extract Builder.show_parsed_files/0 to make it easier to debug import/parsing issues
- builder: remove forgotten b.show_parsed_files/0 call
- util.version: centralise the use of
@VCURRENTHASH
, to minimise the vlang/vc diffs for each commit - builder: support
-d trace_parsed_files
- util: shorten the V paths used in the C
#line
directives with tcc (the ../../../.. etc is no longer needed with newer tcc) (#23974)
Standard library
- json: fix default struct field initialization with long array (#23355)
- markused,builtin,strconv,vlib: reduce generated C sizes for compilers != tcc, for short programs, by simplifying the generation of backtraces, and reducing string interpolations in panics (#23380)
- thirdparty/sokol: allow
-cflags -D_SGL_DEFAULT_MAX_VERTICES=4194304
to customize how many vertices you can send through gg/sokol in a frame - crypto.ecdsa: expand ecdsa module, to support other curves like secp384r1, secp521r1, secp256k1 (#23407)
- crypto.ecdsa: fix memleaks, reported by the CI sanitizer jobs (#23450)
- ci: force the checking of changed vlib/crypto/ecdsa files with the sanitizer jobs
- builtin: add a
@[markused]
tag toisnil()
, because cgen generates calls to it in some cases (#23462) - builtin: reduce a bit the generated #if defined checks for small programs (#23484)
- crypto.ecdsa: improve safety checking, unify signing (and verifying) api to accept options (#23463)
- regex: fix misspelled word "firts" in replace_n description (#23514)
- os: add split_path/1:
os.split_path('/usr/lib/test.so') -> ('/usr/lib','test','.so')
; fix platform dependent behaviour of os.dir/1, os.base/1, os.file_name/1 (#23532) - breaking,log: set stderr as default log output, add .set_output_stream() to allow for opting in the old default of stdout (#23444)
- builtin: add
-prealloc -d prealloc_memset -d prealloc_memset_value=65 -d prealloc_dump
, to better analyze the memory patterns of running V programs - builtin: change the default builder size used for string interpolations, from 256 bytes to 64 bytes
- gg: mark create_image_with_size as deprecated (image resizing is done by
stbi.resize_uint8/3
, with a different fn signature) (#23580) - crypto.ecdsa: split out the C w...
weekly.2025.12
releases: weekly.2025.12
weekly.2025.11
releases: weekly.2025.11
weekly.2025.10
releases: weekly.2025.10
weekly.2025.09
releases: weekly.2025.09
weekly.2025.08
releases: weekly.2025.08
weekly.2025.07
releases: weekly.2025.07
weekly.2025.06
releases: weekly.2025.06