Skip to content

Commit eef4d08

Browse files
committed
ci: fix warning for vlib/v2/types/checker.v leading to clang-linux etc failing with -W
1 parent 7e1a0e7 commit eef4d08

4 files changed

Lines changed: 17 additions & 24 deletions

File tree

‎vlib/v2/gen/arm64/arm64.v‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2746,9 +2746,9 @@ fn (g &Gen) lookup_type_from_env(name string, module_name string) ?types.Type {
27462746
}
27472747
mut scope := &types.Scope(unsafe { nil })
27482748
if s := g.mod.env.get_scope(module_name) {
2749-
scope = s
2749+
scope = unsafe { s }
27502750
} else if s := g.mod.env.get_scope('builtin') {
2751-
scope = s
2751+
scope = unsafe { s }
27522752
} else {
27532753
return none
27542754
}

‎vlib/v2/ssa/builder.v‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,15 @@ fn (b &Builder) is_module_call_receiver(name string) bool {
613613
}
614614
if b.env != unsafe { nil } {
615615
if scope_ref := b.env.get_scope(b.cur_module) {
616-
mut scope := scope_ref
616+
mut scope := unsafe { scope_ref }
617617
if obj := scope.lookup_parent(name, 0) {
618618
if obj is types.Module {
619619
return true
620620
}
621621
}
622622
}
623623
if scope_ref := b.env.get_scope('builtin') {
624-
mut scope := scope_ref
624+
mut scope := unsafe { scope_ref }
625625
if obj := scope.lookup_parent(name, 0) {
626626
if obj is types.Module {
627627
return true
@@ -645,7 +645,7 @@ fn (b &Builder) is_known_c_symbol_name(name string) bool {
645645
}
646646
if b.env != unsafe { nil } {
647647
if scope_ref := b.env.get_scope('C') {
648-
mut scope := scope_ref
648+
mut scope := unsafe { scope_ref }
649649
if _ := scope.lookup_parent(name, 0) {
650650
return true
651651
}
@@ -3460,9 +3460,9 @@ fn (b &Builder) lookup_type_in_scope(name string, module_name string) ?types.Typ
34603460
}
34613461
mut scope := &types.Scope(unsafe { nil })
34623462
if s := b.env.get_scope(module_name) {
3463-
scope = s
3463+
scope = unsafe { s }
34643464
} else if s := b.env.get_scope('builtin') {
3465-
scope = s
3465+
scope = unsafe { s }
34663466
} else {
34673467
return none
34683468
}
@@ -3506,23 +3506,23 @@ fn (b &Builder) lookup_var_type_from_env(name string) ?types.Type {
35063506
mut fn_scope := &types.Scope(unsafe { nil })
35073507
mut found_fn_scope := false
35083508
if s := b.env.get_fn_scope_by_key(fn_name) {
3509-
fn_scope = s
3509+
fn_scope = unsafe { s }
35103510
found_fn_scope = true
35113511
} else if s := b.env.get_fn_scope(b.cur_module, fn_name) {
3512-
fn_scope = s
3512+
fn_scope = unsafe { s }
35133513
found_fn_scope = true
35143514
} else if sep := fn_name.index('__') {
35153515
module_name := fn_name[..sep]
35163516
base_name := fn_name[sep + 2..]
35173517
if s := b.env.get_fn_scope(module_name, base_name) {
3518-
fn_scope = s
3518+
fn_scope = unsafe { s }
35193519
found_fn_scope = true
35203520
} else if module_name != b.cur_module {
35213521
// Method names may use a different module prefix than the
35223522
// checker's scope key (e.g. strings__Builder__method vs
35233523
// main__Builder__method). Retry with the current module.
35243524
if s2 := b.env.get_fn_scope(b.cur_module, base_name) {
3525-
fn_scope = s2
3525+
fn_scope = unsafe { s2 }
35263526
found_fn_scope = true
35273527
}
35283528
}
@@ -3535,9 +3535,9 @@ fn (b &Builder) lookup_var_type_from_env(name string) ?types.Type {
35353535
}
35363536
mut scope := &types.Scope(unsafe { nil })
35373537
if s := b.env.get_scope(b.cur_module) {
3538-
scope = s
3538+
scope = unsafe { s }
35393539
} else if s := b.env.get_scope('builtin') {
3540-
scope = s
3540+
scope = unsafe { s }
35413541
} else {
35423542
return none
35433543
}
@@ -3641,7 +3641,7 @@ fn (mut b Builder) infer_expr_raw_type(expr ast.Expr) ?types.Type {
36413641
}
36423642
if b.env != unsafe { nil } {
36433643
if scope_ref := b.env.get_scope(lhs_ident.name) {
3644-
mut scope := scope_ref
3644+
mut scope := unsafe { scope_ref }
36453645
if obj := scope.lookup_parent(base.rhs.name, 0) {
36463646
return obj.typ()
36473647
}
@@ -4910,7 +4910,7 @@ fn (mut b Builder) try_eval_const_expr_i64(expr ast.Expr) ?i64 {
49104910
}
49114911
}
49124912
.left_shift {
4913-
lhs << rhs
4913+
unsafe { lhs << rhs }
49144914
}
49154915
.right_shift {
49164916
lhs >> rhs
@@ -5277,7 +5277,7 @@ fn (mut b Builder) infer_array_elem_type_from_base_expr(expr ast.Expr) ?TypeID {
52775277
// Module-qualified globals/constants (e.g. os.args).
52785278
if b.env != unsafe { nil } {
52795279
if scope_ref := b.env.get_scope(lhs_ident.name) {
5280-
mut scope := scope_ref
5280+
mut scope := unsafe { scope_ref }
52815281
if obj := scope.lookup_parent(base.rhs.name, 0) {
52825282
if elem_t := b.array_elem_type_from_types_type(obj.typ()) {
52835283
return elem_t
@@ -12991,7 +12991,7 @@ fn (mut b Builder) eval_const_expr(expr ast.Expr) i64 {
1299112991
}
1299212992
}
1299312993
.left_shift {
12994-
lhs << rhs
12994+
unsafe { lhs << rhs }
1299512995
}
1299612996
.right_shift {
1299712997
lhs >> rhs

‎vlib/v2/transformer/transformer_test.v‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) 2026 Alexander Medvednikov. All rights reserved.
22
// Use of this source code is governed by an MIT license
33
// that can be found in the LICENSE file.
4-
// vtest build: false
54
module transformer
65

76
import v2.ast

‎vlib/v2/types/checker.v‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,12 +1116,6 @@ fn (mut c Checker) expr_impl(expr ast.Expr) Type {
11161116
ast.RangeExpr {
11171117
start_type := c.expr(expr.start)
11181118
c.expr(expr.end)
1119-
// Use the start expression type if it's a concrete type (e.g., u8(0) .. 255)
1120-
elem := if start_type is Primitive && !start_type.props.has(.untyped) {
1121-
start_type
1122-
} else {
1123-
int_
1124-
}
11251119
return Type(Array{
11261120
elem_type: start_type
11271121
})

0 commit comments

Comments
 (0)