Skip to content

Commit 737163c

Browse files
committed
v2: fix all tests
1 parent bf2c556 commit 737163c

4 files changed

Lines changed: 12 additions & 83 deletions

File tree

‎vlib/v2/builder/parse_parallel.v‎

Lines changed: 0 additions & 75 deletions
This file was deleted.

‎vlib/v2/transformer/transformer.v‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3124,14 +3124,16 @@ fn (mut t Transformer) try_transform_map_index_push(stmt ast.ExprStmt) ?ast.Stmt
31243124
}))
31253125
})
31263126

3127-
// Common: (array*)map__get_and_set(&m, &key, &empty_array)
3127+
// Common: (array*)map__get(&m, &key, &empty_array)
3128+
// Use map__get (not map__get_and_set) so that pushing to a missing key is a no-op:
3129+
// map__get returns a pointer to the existing value or to the zero value without inserting.
31283130
arr_ptr_expr := ast.Expr(ast.CastExpr{
31293131
typ: ast.Ident{
31303132
name: 'array*'
31313133
}
31323134
expr: ast.CallExpr{
31333135
lhs: ast.Ident{
3134-
name: 'map__get_and_set'
3136+
name: 'map__get'
31353137
}
31363138
args: [
31373139
map_arg,

‎vlib/v2/types/checker.v‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,10 +2217,12 @@ fn (mut c Checker) sync_imported_const_type(source Const) {
22172217
for _, scope_ptr in c.env.scopes {
22182218
mut scope := unsafe { scope_ptr }
22192219
obj := scope.objects[source.name] or { continue }
2220-
if obj is Const && obj.mod == source.mod {
2221-
mut updated := obj
2222-
updated.typ = source.typ
2223-
scope.objects[source.name] = Object(updated)
2220+
if obj is Const {
2221+
if obj.mod == source.mod {
2222+
mut updated := obj
2223+
updated.typ = source.typ
2224+
scope.objects[source.name] = Object(updated)
2225+
}
22242226
}
22252227
}
22262228
}

‎vlib/v2/types/types.v‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ fn value_type_with_depth(t Type, depth int) Type {
404404
if elem_type := t.elem_type {
405405
return elem_type
406406
}
407-
return Type(Channel{})
407+
return Type(empty_channel())
408408
} // TODO: ?
409409
Map {
410410
return t.value_type
@@ -427,7 +427,7 @@ fn value_type_with_depth(t Type, depth int) Type {
427427
if elem_type := t.elem_type {
428428
return elem_type
429429
}
430-
return Type(Thread{})
430+
return Type(empty_thread())
431431
} // TODO: ?
432432
OptionType, ResultType {
433433
return value_type_with_depth(t.base_type, depth + 1)

0 commit comments

Comments
 (0)