Releases: vlang/v
Releases · vlang/v
weekly.2024.52
releases: weekly.2024.52
0.4.9
22 Dec 2024
Improvements in the language
-skip-unused
is now on by default resulting in much smaller cgen and binaries. 70% reduction for hello world.-parallel-cc
for speeding up-prod
and-cc clang/gcc
compilation by up to 14 times!- C functions no longer need to be manually defined. An
#include "foo.c"
is enough (behind-experimental
for now). - Fixed arrays now have
.index .any .all .map .sort .sorted
methods - Remove inline sum types completely
- Support
in
expr with number ranges:if var in 1..4 {
(fix #20352) (#22754) - Optimize literal string comparison (
match
,in
and==
) (#22643) - Allow
map[k]()?
andmap[k]()()
(#22740) - Add selector option unwrapping inside
if tree.root != none {
(#22895) - Add
array.count
as a method that accepts a predicate, similar to filter, but returning just the number of matches (#23054) - Allow option array element comparison
==
and!=
(fix #23108) (#23113)
Breaking changes
- time: rewrite parse_rfc3339/1 to improve performance, reject partial timestamps, that miss date info like
22:47:08Z
(#22585)
Checker improvements/fixes
- Optimize identical type checking (#22596)
- Fix
T.unaliased_typ
if branch evaluation (fix #22587) (#22598) - Fix lambda expr with fntype params and restore fixed_array_any_all_test.v (#22625)
- Check fixed array builtin method args mismatch (#22626)
- Fix generic fn call return type resolve on var assignment (fix #22612) (#22627)
- Improve checking parameter mismatches for fixed array builtin methods (#22630)
- Add tests for checking the new errors for fixed arrays .sort() calls (#22656)
- Fix index expr that left is if expr (fix #22654) (#22661)
- Fix return type checks, when returning struct values, implementing IError in non-result fn (fix #22659) (fix #22658) (#22660)
App.method
field initialisation, for fn fields, initialised with generic methods (#22665)- Allow for
f() or { T{} }
in a generic method, forfn f() ?T {
, being called withT
, being a container like []int etc, not just a primitive type like int (#22672) - Allow for
f() or { T{} }
part 2, see also cc55aa5 (handle the case of an ignored result as well) (#22687) - Fix selector with prefixed
&
structinit (#22689) - Fix missing check for fn var with generic return inherited to anon fn (fix #19045) (#22683)
- Check for receiver name clashing with global var (fix #22698) (#22708)
- Fix none check for match expr with option (fix #22728) (#22732)
- Fix option map fn type and missing check for result param type (fix #22736) (#22738)
- Fix missing info about generic fn var usage without concrete types (fix #22733, #22734) (#22743)
- Fix missing check for stack pointer return (fix #22726) (#22756)
- Improve static method call resolution (fix #22773) (#22787)
- Skip redundant message for int overflows, while casting integer literals (fix #22761) (#22788)
- Fix callexpr after auto C func identification (fix #22800) (#22809)
- Fix missing auto
from_string
type restriction (related to #22783) (#22803) - Fix match expr with empty array init expression (#22832)
- Disallow
foo[T]
as a value (#22820) - Fix if expr with empty array init expression (related #22832) (#22841)
- Improve the position underlining, for last statements in branches of
if
expressions (#22845) - Fix generic fn call with empty array argument (fix #22843) (#22846)
- Fix missing or-block check for callexpr (fix #22835) (#22840)
- Check array builtin method calls, that do need a mutable receiver, but are called on an immutable one (fix #22850) (#22853)
- Check alias of array op overloading and fix op overloading (fix #22851) (#22854)
- Disallow struct init with
mutable_field: const_array
(fix #22862) (#22863) - Check struct aliased field unsign type assigning negative value (fix #22868) (#22871)
- Fix alias to struct generic type (fix #22866) (#22872)
- Fix
json.encode_pretty
with a struct init expression argument (#22897) - Fix codegen for fixed array initialization with a fn call (fix #22887) (#22891)
- Fix or-expr check on invalid method call (fix #22949) (#22950)
- Fix mut var option unwrap with
!= none
, supportif mut x != none {
too (fix #22936) (#22943) - Prevent a compiler panic, while running
v -check file.v
on files with parser errors (fix #22981) (#22982) - Allow array sort with callexpr (#22989)
- Fix
$res()
used indefer {}
blocks with more statements, add a test (#22998) - Fix generec fn returning generic closure (#23047)
- Fix generic fn returning generic closure (related #23047) (#23055)
- Fix missing checker for cast from mut var to non-ptr type (fix #23017) (#23056)
- Check fn call argument mismatch (fix #23016) (#23061)
- Fix empty array append multi dims (fix #23092) (#23096)
- Fix selector generic or block (fix #23088) (#23102)
- Fix veb route method param with non ctx name (fix #23105) (#23107)
- Allow fixed array where voidptr is expected (fix #23090) (#23100)
- Fix immutable to mutable reference (fix #22653) (#22663)
- Fix missing check on range expr when high var is same iteration value var (#23130)
- Allow
[]Enum{len: 10, init: .thing}
(fix #23077) (#23165) - Fix option unwrapping and call from option struct field (#23182)
- Add a notice for global variable redeclarations (#23162)
- Fix assign check, when rechecking for another concrete type (#23212)
Parser improvements
- Fix generic struct init detection
T{}
(#22682) - Improve the assert informations (related #22668) (#22679)
- Make C struct fields public and mutable by default (fix #22695) (#22706)
- Fix enum redeclaration error (fix #22759) (#22766)
- Fix struct field name using keyword (fix #22826) (#22829)
- Optimise mark_var_as_used calls, by moving it to an ast.Scope method (#22842)
- Optimize method parameter detection in used check (#22915)
- Fix block position's last line (#22913)
- Support
@[must_use]
tag for fns/methods, and an experimental-check-result
option (#22983) - Allow
type
as field type on params struct construction (fix #23091) (#23098) - Allow
type
and other keywords as plain attr value (fix #23150) (#23154) - Support
@[tag]
for hash statements, like#define
and#flag
(#23210)
Compiler internals
- Add
:parse_text
to the paths of .v files, printed by-print-v-files
, for parse time generated snippets - v.pref: support a
_wasm32_emscripten.c.v
suffix for platform files too - builder: fix msvc build thirdparty obj file from .cpp (fix #22772) (#22789)
- v.util: use temporary workaround for the vinix build problem (when VFLAGS is set, and
-ldflags
is passed at the same time) - Allow getting notified about unused function params (#22879)
- v.scanner: remove
Scanner.is_started
field (#22918) - v.scanner: fix string interpolation for float e format (fix #22429) (#23147)
- cbuilder: remove flto with parallel-cc, it slowed down linking 10x
- cbuilder: store split up C files in vtmp
- v.builder: integrate more compile/linker options into parallel_cc.v (#23190)
- v.builder: prevent passing
-x objective-c
with-parallel-cc
for now - v.builder: move filtering logic for
-parallel-cc
to parallel_cc.v - v.pref: support
-debug
and-cdebug
, as more explicit alternative names for-g
and-cg
(#23208) - v.builder: fail the whole v compilation, if linking or compiling during
-parallel-cc
fails (#23211) - v.pref: implement
-no-prod-options
to turn off passing-O3 -flto
, while still keeping the$if prod {
branches (passing custom flags with-cflags -Os
already works) - v.builder: support
-no-prod-options
with-cc msvc
as well
Standard library
- builtin: improve performance of
string.starts_with/1
andstring.ends_with/1
, when compiled with tcc (#22620) - builtin: improve
fixed_array_any_all_test.v
(related #22609) (#22621) - builtin: temporary fix fixed_array_any_all_test.v (#22624)
- builtin: support
-d no_gc_threads
for turning off passing-DGC_THREADS=1
while compiling the GC library - encoding.utf8: fix is_punct func (fix #22646) (#22647)
- log,time: improve performance for writing a line to a log, add Time.format_rfc3339_micro/0 (#22662)
- flag: add missing short flag match in
flag.to_struct
, add test (#22696) - bitfield: add
shift_left/1
andshift_right/1
methods toBitField
(#22700) - x.json2: pre-arranging the replacement of the decoder, to match https://github.com/enghitalo/v/tree/decoder2_to_json2 (#22729)
- builtin: improve fixed_array_any_all_test.v (#22746)
- builtin: add
string.is_pure_ascii()
(#22748) - os: document the various enum values in os.Signal (#22770)
- builtin: fix runes.to_upper() (fix #22742) (#22755)
- ci: use os.system to redirect output
- builtin: minor optimization in rune.map_to() (#22810)
- vlib: initial addition of
x.encoding.asn1
(#22783) - os: work towards being able to again use
-autofree
while recompiling the V compiler several times - x.encoding.asn1: fix time creation to also accommodate negative timezone offsets (#22861)
- vlib: remove modules/functions/fields, deprecated in 2023 (#22750)
- term: improve performance of repeated can_show_color_on_stdout and can_show_color_on_stderr calls, by caching their results (#22893)
- builtin: make int_min/2 and int_max/2 public
- json: mark json_print_pretty/1 with
@[markused]
(used by cgen) - math.big: use
@[manualfree]
to workaround -autofree compilation issues with gitly, and other projects usingcrypto.rand
andmath.big
- x.encoding.asn1: improve performance (#22948)
- gg: use a larger fontstash text atlas by default (2048x2048, and customizable), instead of 512x512 (fix #21610) (#22959)
- Revert "os: deprecate
os.getwd
in favor ofos.get_current_dir
(part 1) (#22966)" - log: tag log.fatal with @[noreturn] (#22986)
- runtime: force runtime.nr_jobs() to return 1, while V is bootstrapping itself, from vc/ source, that was compiled with ...
weekly.2024.51
releases: weekly.2024.51
weekly.2024.50
releases: weekly.2024.50
weekly.2024.49
releases: weekly.2024.49
weekly.2024.48
releases: weekly.2024.48
weekly.2024.47
releases: weekly.2024.47
weekly.2024.46
releases: weekly.2024.46
weekly.2024.45
releases: weekly.2024.45
weekly.2024.44
releases: weekly.2024.44