diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v
index e253898875..675182cc4a 100644
--- a/cmd/tools/vdoc/html.v
+++ b/cmd/tools/vdoc/html.v
@@ -134,7 +134,7 @@ fn (vd VDoc) render_search_index(out Output) {
}
fn (mut vd VDoc) render_static_html(out Output) {
- vd.assets = map{
+ vd.assets = {
'doc_css': vd.get_resource(css_js_assets[0], out)
'normalize_css': vd.get_resource(css_js_assets[1], out)
'doc_js': vd.get_resource(css_js_assets[2], out)
diff --git a/cmd/tools/vpm.v b/cmd/tools/vpm.v
index a503d249fd..139486c1c4 100644
--- a/cmd/tools/vpm.v
+++ b/cmd/tools/vpm.v
@@ -17,15 +17,15 @@ const (
excluded_dirs = ['cache', 'vlib']
supported_vcs_systems = ['git', 'hg']
supported_vcs_folders = ['.git', '.hg']
- supported_vcs_update_cmds = map{
+ supported_vcs_update_cmds = {
'git': 'git pull'
'hg': 'hg pull --update'
}
- supported_vcs_install_cmds = map{
+ supported_vcs_install_cmds = {
'git': 'git clone --depth=1'
'hg': 'hg clone'
}
- supported_vcs_outdated_steps = map{
+ supported_vcs_outdated_steps = {
'git': ['git fetch', 'git rev-parse @', 'git rev-parse @{u}']
'hg': ['hg incoming']
}
@@ -467,7 +467,7 @@ fn resolve_dependencies(name string, module_path string, module_names []string)
fn parse_vmod(data string) Vmod {
keys := ['name', 'version', 'deps']
- mut m := map{
+ mut m := {
'name': ''
'version': ''
'deps': ''
diff --git a/cmd/tools/vtest-parser.v b/cmd/tools/vtest-parser.v
index e1e829ae6f..2743d2dabf 100644
--- a/cmd/tools/vtest-parser.v
+++ b/cmd/tools/vtest-parser.v
@@ -12,7 +12,7 @@ const (
support_color = term.can_show_color_on_stderr() && term.can_show_color_on_stdout()
ecode_timeout = 101
ecode_memout = 102
- ecode_details = map{
+ ecode_details = {
-1: 'worker executable not found'
101: 'too slow'
102: 'too memory hungry'
diff --git a/doc/docs.md b/doc/docs.md
index 8fbaa2dba8..057a4cfaf9 100644
--- a/doc/docs.md
+++ b/doc/docs.md
@@ -1042,7 +1042,7 @@ Maps can have keys of type string, rune, integer, float or voidptr.
The whole map can be initialized using this short syntax:
```v
-numbers := map{
+numbers := {
'one': 1
'two': 2
}
@@ -1052,14 +1052,14 @@ println(numbers)
If a key is not found, a zero value is returned by default:
```v
-sm := map{
+sm := {
'abc': 'xyz'
}
val := sm['bad_key']
println(val) // ''
```
```v
-intm := map{
+intm := {
1: 1234
2: 5678
}
@@ -1306,7 +1306,7 @@ To do the opposite, use `!in`.
nums := [1, 2, 3]
println(1 in nums) // true
println(4 !in nums) // true
-m := map{
+m := {
'one': 1
'two': 2
}
@@ -1421,7 +1421,7 @@ The code above prints:
##### Map `for`
```v
-m := map{
+m := {
'one': 1
'two': 2
}
@@ -1434,7 +1434,7 @@ for key, value in m {
Either key or value can be ignored by using a single underscore as the identifier.
```v
-m := map{
+m := {
'one': 1
'two': 2
}
@@ -1783,7 +1783,7 @@ mut p := Point{
y: 20
}
// you can omit the struct name when it's already known
-p = {
+p = Point{
x: 30
y: 4
}
@@ -1935,7 +1935,7 @@ clr1 := Rgba32{
}
clr2 := Rgba32{
- Rgba32_Component: {
+ Rgba32_Component: Rgba32_Component{
a: 128
}
}
@@ -2029,7 +2029,7 @@ struct User {
}
fn register(u User) User {
- return {
+ return User{
...u
is_registered: true
}
@@ -2095,7 +2095,7 @@ fn main() {
// You can even have an array/map of functions:
fns := [sqr, cube]
println(fns[0](10)) // "100"
- fns_map := map{
+ fns_map := {
'sqr': sqr
'cube': cube
}
diff --git a/examples/bfs.v b/examples/bfs.v
index b92763ebc5..ff20fdf867 100644
--- a/examples/bfs.v
+++ b/examples/bfs.v
@@ -26,7 +26,7 @@ fn breadth_first_search_path(graph map[string][]string, vertex string, target st
}
fn main() {
- graph := map{
+ graph := {
'A': ['B', 'C']
'B': ['A', 'D', 'E']
'C': ['A', 'F']
diff --git a/examples/sokol/05_instancing_glsl/rt_glsl.v b/examples/sokol/05_instancing_glsl/rt_glsl.v
index f06a8e3aa9..6c32fd5334 100644
--- a/examples/sokol/05_instancing_glsl/rt_glsl.v
+++ b/examples/sokol/05_instancing_glsl/rt_glsl.v
@@ -503,7 +503,7 @@ fn main(){
gg: 0
}
- app.gg = gg.new_context({
+ app.gg = gg.new_context(
width: win_width
height: win_height
create_window: true
@@ -514,7 +514,7 @@ fn main(){
init_fn: my_init
cleanup_fn: cleanup
event_fn: my_event_manager
- })
+ )
app.ticks = time.ticks()
app.gg.run()
diff --git a/vlib/bitfield/bitfield.v b/vlib/bitfield/bitfield.v
index 9ed4e2bdd5..35ac552801 100644
--- a/vlib/bitfield/bitfield.v
+++ b/vlib/bitfield/bitfield.v
@@ -338,22 +338,6 @@ pub fn (instance BitField) clone() BitField {
return output
}
-// cmp compares two bit arrays bit by bit and returns 'true' if they are
-// identical by length and contents and 'false' otherwise.
-[deprecated: 'use a == b instead']
-[deprecated_after: '2021-06-29']
-pub fn (instance BitField) cmp(input BitField) bool {
- if instance.size != input.size {
- return false
- }
- for i in 0 .. zbitnslots(instance.size) {
- if instance.field[i] != input.field[i] {
- return false
- }
- }
- return true
-}
-
pub fn (a BitField) == (b BitField) bool {
if a.size != b.size {
return false
diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v
index 288a884011..24ca54d538 100644
--- a/vlib/builtin/array_test.v
+++ b/vlib/builtin/array_test.v
@@ -745,13 +745,13 @@ fn test_eq() {
age: 22
name: 'bob'
}]
- assert [map{
+ assert [{
'bob': 22
- }, map{
+ }, {
'tom': 33
- }] == [map{
+ }] == [{
'bob': 22
- }, map{
+ }, {
'tom': 33
}]
assert [[1, 2, 3], [4]] == [[1, 2, 3], [4]]
@@ -1315,20 +1315,20 @@ fn test_struct_array_of_multi_type_in() {
ivan := Person{
name: 'ivan'
nums: [1, 2, 3]
- kv: map{
+ kv: {
'aaa': '111'
}
}
people := [Person{
name: 'ivan'
nums: [1, 2, 3]
- kv: map{
+ kv: {
'aaa': '111'
}
}, Person{
name: 'bob'
nums: [2]
- kv: map{
+ kv: {
'bbb': '222'
}
}]
@@ -1340,20 +1340,20 @@ fn test_struct_array_of_multi_type_index() {
ivan := Person{
name: 'ivan'
nums: [1, 2, 3]
- kv: map{
+ kv: {
'aaa': '111'
}
}
people := [Person{
name: 'ivan'
nums: [1, 2, 3]
- kv: map{
+ kv: {
'aaa': '111'
}
}, Person{
name: 'bob'
nums: [2]
- kv: map{
+ kv: {
'bbb': '222'
}
}]
diff --git a/vlib/builtin/map_of_floats_test.v b/vlib/builtin/map_of_floats_test.v
index 3906cb1288..7481107928 100644
--- a/vlib/builtin/map_of_floats_test.v
+++ b/vlib/builtin/map_of_floats_test.v
@@ -12,7 +12,7 @@ fn test_map_of_f32() {
}
fn test_map_of_f64() {
- mut m64 := map{
+ mut m64 := {
3.14: 'pi'
}
m64[1.0] = 'one'
diff --git a/vlib/builtin/map_test.v b/vlib/builtin/map_test.v
index 9c50ab73ed..f186dd5a59 100644
--- a/vlib/builtin/map_test.v
+++ b/vlib/builtin/map_test.v
@@ -130,7 +130,7 @@ fn test_map() {
fn test_map_init() {
one := 'one'
three := 'three'
- m := map{
+ m := {
one: 1
'two': 2
three: 1 + 2
@@ -346,25 +346,25 @@ fn test_map_assign() {
mut a := map[string]f64{}
mut b := map[string]int{}
mut c := map[string]u16{}
- a = map{
+ a = {
'x': 12.4
'y': 3
}
- b = map{
+ b = {
'u': -13
'v': 12
}
- c = map{
+ c = {
's': u16(5)
't': 3
}
- _ := Mstruct1{map{
+ _ := Mstruct1{{
'p': 12
}}
- _ := Mstruct2{map{
+ _ := Mstruct2{{
'q': 1.7
}}
- _ := Mstruct3{map{
+ _ := Mstruct3{{
'r': u16(6)
's': 5
}}
@@ -398,7 +398,7 @@ fn test_assign_directly() {
}
fn test_map_in_directly() {
- for k, v in map{
+ for k, v in {
'aa': 1
} {
assert k == 'aa'
@@ -407,7 +407,7 @@ fn test_map_in_directly() {
}
fn test_plus_assign_string() {
- mut m := map{
+ mut m := {
'one': ''
}
m['one'] += '1'
@@ -416,7 +416,7 @@ fn test_plus_assign_string() {
}
fn test_map_keys_to_array() {
- m := map{
+ m := {
'a': 'b'
'c': 'd'
}
@@ -436,7 +436,7 @@ fn map_in_mut(mut m map[string]int) {
}
fn test_map_in_mut() {
- mut m := map{
+ mut m := {
'one': 1
}
map_in_mut(mut m)
@@ -444,7 +444,7 @@ fn test_map_in_mut() {
}
fn test_map_in() {
- m := map{
+ m := {
'Foo': 'bar'
}
if 'foo'.capitalize() in m {
@@ -476,7 +476,7 @@ fn mut_map_with_relation_op_in_fn(mut m map[string]int) {
}
fn test_mut_map_with_relation_op_in_fn() {
- mut m := map{
+ mut m := {
'one': 1
'two': 2
}
@@ -490,7 +490,7 @@ fn test_mut_map_with_relation_op_in_fn() {
}
fn test_map_str_after_delete() {
- mut m := map{
+ mut m := {
'first': 1
'second': 2
'third': 3
@@ -504,7 +504,7 @@ fn test_map_str_after_delete() {
}
fn test_modify_map_value() {
- mut m1 := map{
+ mut m1 := {
'foo': 3
'bar': -7
}
@@ -515,7 +515,7 @@ fn test_modify_map_value() {
}
fn test_map_clone() {
- mut nums := map{
+ mut nums := {
'foo': 1
'bar': 2
}
@@ -542,7 +542,7 @@ fn test_map_default_zero() {
}
fn test_map_or() {
- m := map{
+ m := {
'first': 1
'second': 2
'third': 3
@@ -561,7 +561,7 @@ fn test_int_keys() {
m[5] += 24
m[5]++
assert m[5] == 25
- mut m2 := map{
+ mut m2 := {
3: 9
4: 16
5: 25
@@ -577,7 +577,7 @@ fn test_int_keys() {
assert m2[5] == 0
assert m2.keys() == []
- m2 = map{
+ m2 = {
3: 9
4: 16
5: 25
@@ -598,7 +598,7 @@ fn test_int_keys() {
}
assert all == [3, 9, 4, 16, 5, 25]
- mut m3 := map{
+ mut m3 := {
1: 'one'
2: 'two'
}
@@ -639,7 +639,7 @@ fn test_voidptr_keys() {
}
fn test_rune_keys() {
- mut m := map{
+ mut m := {
`!`: 2
`%`: 3
}
@@ -659,62 +659,62 @@ fn test_rune_keys() {
}
fn test_eq() {
- a := map{
+ a := {
'a': 1
'b': 2
}
- assert a == map{
+ assert a == {
'a': 1
'b': 2
}
- b := map{
+ b := {
'a': [[1]]
'b': [[2]]
}
- assert b == map{
+ assert b == {
'a': [[1]]
'b': [[2]]
}
- c := map{
- 'a': map{
+ c := {
+ 'a': {
'11': 1
}
- 'b': map{
+ 'b': {
'22': 2
}
}
- assert c == map{
- 'a': map{
+ assert c == {
+ 'a': {
'11': 1
}
- 'b': map{
+ 'b': {
'22': 2
}
}
- d := map{
+ d := {
'a': MValue{
name: 'aa'
- misc: map{
+ misc: {
'11': '1'
}
}
'b': MValue{
name: 'bb'
- misc: map{
+ misc: {
'22': '2'
}
}
}
- assert d == map{
+ assert d == {
'a': MValue{
name: 'aa'
- misc: map{
+ misc: {
'11': '1'
}
}
'b': MValue{
name: 'bb'
- misc: map{
+ misc: {
'22': '2'
}
}
@@ -722,31 +722,31 @@ fn test_eq() {
}
fn test_non_string_key_map_str() {
- assert map{
+ assert {
23: 4
}.str() == '{23: 4}'
- assert map{
+ assert {
`a`: 12
`b`: 13
}.str() == '{`a`: 12, `b`: 13}'
- assert map{
+ assert {
23: 'foo'
25: 'bar'
}.str() == "{23: 'foo', 25: 'bar'}"
}
fn test_map_assign_empty_map_init() {
- mut a := map{
+ mut a := {
'one': 1
}
- a = map{}
+ a = {}
println(a)
assert a == map[string]int{}
assert '$a' == '{}'
}
fn test_in_map_literal() {
- assert 1 in map{
+ assert 1 in {
1: 'one'
}
}
diff --git a/vlib/gx/color.v b/vlib/gx/color.v
index eefebb8c21..e50d9325db 100644
--- a/vlib/gx/color.v
+++ b/vlib/gx/color.v
@@ -205,7 +205,7 @@ pub fn (c Color) abgr8() int {
}
const (
- string_colors = map{
+ string_colors = {
'blue': blue
'red': red
'green': green
diff --git a/vlib/hash/wyhash.c.v b/vlib/hash/wyhash.c.v
index 758af0306b..164ebeecb8 100644
--- a/vlib/hash/wyhash.c.v
+++ b/vlib/hash/wyhash.c.v
@@ -7,7 +7,7 @@ fn C.wyhash(&byte, u64, u64, &u64) u64
fn C.wyhash64(u64, u64) u64
fn init() {
- _ := map{
+ _ := {
1: 1
}
}
diff --git a/vlib/io/reader.v b/vlib/io/reader.v
index b7377b0872..61f566f46c 100644
--- a/vlib/io/reader.v
+++ b/vlib/io/reader.v
@@ -9,16 +9,6 @@ pub interface Reader {
read(mut buf []byte) ?int
}
-// make_reader is a temp that converts a type to a reader
-// (e.g. for use in struct initialisation)
-// (this shouldnt need to be a thing but until coercion gets made better
-// it is required)
-[deprecated: 'use just `x` instead of `io.make_reader(x)`. Interfaces are now checked against all types.']
-[deprecated_after: '2021-05-27']
-pub fn make_reader(r Reader) Reader {
- return r
-}
-
const (
read_all_len = 10 * 1024
read_all_grow_len = 1024
diff --git a/vlib/json/json_test.v b/vlib/json/json_test.v
index 8191462eeb..f10db853bb 100644
--- a/vlib/json/json_test.v
+++ b/vlib/json/json_test.v
@@ -151,7 +151,7 @@ fn test_struct_in_struct() ? {
fn test_encode_map() {
expected := '{"one":1,"two":2,"three":3,"four":4}'
- numbers := map{
+ numbers := {
'one': 1
'two': 2
'three': 3
@@ -163,7 +163,7 @@ fn test_encode_map() {
}
fn test_parse_map() ? {
- expected := map{
+ expected := {
'one': 1
'two': 2
'three': 3
@@ -193,7 +193,7 @@ fn test_nested_type() ? {
cities: [City{'Donlon'}, City{'Termanches'}]
},
]
- users: map{
+ users: {
'Foo': User{
age: 10
nums: [1, 2, 3]
@@ -211,14 +211,14 @@ fn test_nested_type() ? {
pets: 'little boo'
}
}
- extra: map{
- '2': map{
+ extra: {
+ '2': {
'n1': 2
'n2': 4
'n3': 8
'n4': 16
}
- '3': map{
+ '3': {
'n1': 3
'n2': 9
'n3': 27
diff --git a/vlib/net/html/parser.v b/vlib/net/html/parser.v
index b9ad2a1266..461c145bc1 100644
--- a/vlib/net/html/parser.v
+++ b/vlib/net/html/parser.v
@@ -14,7 +14,7 @@ mut:
opened_code_type string
line_count int
lexeme_builder strings.Builder = strings.new_builder(100)
- code_tags map[string]bool = map{
+ code_tags map[string]bool = {
'script': true
'style': true
}
diff --git a/vlib/net/http/cookie_test.v b/vlib/net/http/cookie_test.v
index 3806618fb8..6a0c0cd8ff 100644
--- a/vlib/net/http/cookie_test.v
+++ b/vlib/net/http/cookie_test.v
@@ -257,7 +257,7 @@ const (
]
read_set_cookies_tests = [
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['Cookie-1=v1']
}
cookies: [&http.Cookie{
@@ -292,7 +292,7 @@ const (
// }]
// },
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['ASP.NET_SessionId=foo; path=/; HttpOnly']
}
cookies: [
@@ -306,7 +306,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['samesitedefault=foo; SameSite']
}
cookies: [
@@ -319,7 +319,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['samesitelax=foo; SameSite=Lax']
}
cookies: [
@@ -332,7 +332,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['samesitestrict=foo; SameSite=Strict']
}
cookies: [
@@ -345,7 +345,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['samesitenone=foo; SameSite=None']
}
cookies: [
@@ -360,7 +360,7 @@ const (
// Make sure we can properly read back the Set-Cookie headers we create
// for values containing spaces or commas:
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-1=a z']
}
cookies: [
@@ -372,7 +372,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-2=" z"']
}
cookies: [
@@ -384,7 +384,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-3="a "']
}
cookies: [
@@ -396,7 +396,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-4=" "']
}
cookies: [
@@ -408,7 +408,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-5=a,z']
}
cookies: [
@@ -420,7 +420,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-6=",z"']
}
cookies: [
@@ -432,7 +432,7 @@ const (
]
},
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-7=","']
}
cookies: [
diff --git a/vlib/net/http/header.v b/vlib/net/http/header.v
index e96563ec5e..dadf13305b 100644
--- a/vlib/net/http/header.v
+++ b/vlib/net/http/header.v
@@ -216,7 +216,7 @@ pub fn (h CommonHeader) str() string {
}
}
-const common_header_map = map{
+const common_header_map = {
'accept': CommonHeader.accept
'accept-ch': .accept_ch
'accept-charset': .accept_charset
diff --git a/vlib/net/http/header_test.v b/vlib/net/http/header_test.v
index 3740d8afcd..55eb2bedc3 100644
--- a/vlib/net/http/header_test.v
+++ b/vlib/net/http/header_test.v
@@ -276,7 +276,7 @@ fn test_str() ? {
}
fn test_header_from_map() ? {
- h := new_header_from_map(map{
+ h := new_header_from_map({
CommonHeader.accept: 'nothing'
CommonHeader.expires: 'yesterday'
})
@@ -287,7 +287,7 @@ fn test_header_from_map() ? {
}
fn test_custom_header_from_map() ? {
- h := new_custom_header_from_map(map{
+ h := new_custom_header_from_map({
'Server': 'VWeb'
'foo': 'bar'
}) ?
@@ -298,11 +298,11 @@ fn test_custom_header_from_map() ? {
}
fn test_header_join() ? {
- h1 := new_header_from_map(map{
+ h1 := new_header_from_map({
CommonHeader.accept: 'nothing'
CommonHeader.expires: 'yesterday'
})
- h2 := new_custom_header_from_map(map{
+ h2 := new_custom_header_from_map({
'Server': 'VWeb'
'foo': 'bar'
}) ?
@@ -329,27 +329,27 @@ fn parse_headers_test(s string, expected map[string]string) ? {
}
fn test_parse_headers() ? {
- parse_headers_test('foo: bar', map{
+ parse_headers_test('foo: bar', {
'foo': 'bar'
}) ?
- parse_headers_test('foo: \t bar', map{
+ parse_headers_test('foo: \t bar', {
'foo': 'bar'
}) ?
- parse_headers_test('foo: bar\r\n\tbaz', map{
+ parse_headers_test('foo: bar\r\n\tbaz', {
'foo': 'bar baz'
}) ?
- parse_headers_test('foo: bar \r\n\tbaz\r\n buzz', map{
+ parse_headers_test('foo: bar \r\n\tbaz\r\n buzz', {
'foo': 'bar baz buzz'
}) ?
- parse_headers_test('foo: bar\r\nbar:baz', map{
+ parse_headers_test('foo: bar\r\nbar:baz', {
'foo': 'bar'
'bar': 'baz'
}) ?
- parse_headers_test('foo: bar\r\nbar:baz\r\n', map{
+ parse_headers_test('foo: bar\r\nbar:baz\r\n', {
'foo': 'bar'
'bar': 'baz'
}) ?
- parse_headers_test('foo: bar\r\nbar:baz\r\n\r\n', map{
+ parse_headers_test('foo: bar\r\nbar:baz\r\n\r\n', {
'foo': 'bar'
'bar': 'baz'
}) ?
diff --git a/vlib/net/http/http_httpbin_test.v b/vlib/net/http/http_httpbin_test.v
index 20230992a0..e40778d8a0 100644
--- a/vlib/net/http/http_httpbin_test.v
+++ b/vlib/net/http/http_httpbin_test.v
@@ -59,7 +59,7 @@ fn test_http_fetch_with_params() {
return
}
responses := http_fetch_mock([],
- params: map{
+ params: {
'a': 'b'
'c': 'd'
}
diff --git a/vlib/net/http/request_test.v b/vlib/net/http/request_test.v
index d0baf51dd0..3950ad80a3 100644
--- a/vlib/net/http/request_test.v
+++ b/vlib/net/http/request_test.v
@@ -71,27 +71,27 @@ fn test_parse_request_line() {
}
fn test_parse_form() {
- assert parse_form('foo=bar&bar=baz') == map{
+ assert parse_form('foo=bar&bar=baz') == {
'foo': 'bar'
'bar': 'baz'
}
- assert parse_form('foo=bar=&bar=baz') == map{
+ assert parse_form('foo=bar=&bar=baz') == {
'foo': 'bar='
'bar': 'baz'
}
- assert parse_form('foo=bar%3D&bar=baz') == map{
+ assert parse_form('foo=bar%3D&bar=baz') == {
'foo': 'bar='
'bar': 'baz'
}
- assert parse_form('foo=b%26ar&bar=baz') == map{
+ assert parse_form('foo=b%26ar&bar=baz') == {
'foo': 'b&ar'
'bar': 'baz'
}
- assert parse_form('a=b& c=d') == map{
+ assert parse_form('a=b& c=d') == {
'a': 'b'
' c': 'd'
}
- assert parse_form('a=b&c= d ') == map{
+ assert parse_form('a=b&c= d ') == {
'a': 'b'
'c': ' d '
}
@@ -115,7 +115,7 @@ ${contents[1]}
--------------------------$boundary--
"
form, files := parse_multipart_form(data, boundary)
- assert files == map{
+ assert files == {
names[0]: [FileData{
filename: file
content_type: ct
@@ -123,7 +123,7 @@ ${contents[1]}
}]
}
- assert form == map{
+ assert form == {
names[1]: contents[1]
}
}
diff --git a/vlib/orm/orm.v b/vlib/orm/orm.v
index 589031adf4..13f833809b 100644
--- a/vlib/orm/orm.v
+++ b/vlib/orm/orm.v
@@ -8,7 +8,7 @@ pub const (
float = [13, 14]
string = 18
time = -2
- type_idx = map{
+ type_idx = {
'i8': 5
'i16': 6
'int': 7
diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v
index a34423e7df..44a6eb9848 100644
--- a/vlib/v/ast/ast.v
+++ b/vlib/v/ast/ast.v
@@ -1213,7 +1213,7 @@ pub:
pub const (
// reference: https://en.wikipedia.org/wiki/X86#/media/File:Table_of_x86_Registers_svg.svg
// map register size -> register name
- x86_no_number_register_list = map{
+ x86_no_number_register_list = {
8: ['al', 'ah', 'bl', 'bh', 'cl', 'ch', 'dl', 'dh', 'bpl', 'sil', 'dil', 'spl']
16: ['ax', 'bx', 'cx', 'dx', 'bp', 'si', 'di', 'sp', /* segment registers */ 'cs', 'ss',
'ds', 'es', 'fs', 'gs', 'flags', 'ip', /* task registers */ 'gdtr', 'idtr', 'tr', 'ldtr',
@@ -1240,32 +1240,32 @@ pub const (
// st#: floating point numbers
// cr#: control/status registers
// dr#: debug registers
- x86_with_number_register_list = map{
- 8: map{
+ x86_with_number_register_list = {
+ 8: {
'r#b': 16
}
- 16: map{
+ 16: {
'r#w': 16
}
- 32: map{
+ 32: {
'r#d': 16
}
- 64: map{
+ 64: {
'r#': 16
'mm#': 16
'cr#': 16
'dr#': 16
}
- 80: map{
+ 80: {
'st#': 16
}
- 128: map{
+ 128: {
'xmm#': 32
}
- 256: map{
+ 256: {
'ymm#': 32
}
- 512: map{
+ 512: {
'zmm#': 32
}
}
@@ -1277,14 +1277,14 @@ pub const (
'sp' /* aka r13 */, 'lr' /* aka r14 */, /* this is instruction pointer ('program counter'): */
'pc' /* aka r15 */,
] // 'cpsr' and 'apsr' are special flags registers, but cannot be referred to directly
- arm_with_number_register_list = map{
+ arm_with_number_register_list = {
'r#': 16
}
)
pub const (
riscv_no_number_register_list = ['zero', 'ra', 'sp', 'gp', 'tp']
- riscv_with_number_register_list = map{
+ riscv_with_number_register_list = {
'x#': 32
't#': 3
's#': 12
diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v
index 3090585341..4d7f431d20 100644
--- a/vlib/v/checker/checker.v
+++ b/vlib/v/checker/checker.v
@@ -1338,13 +1338,6 @@ pub fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
}
node.left_type = map_info.key_type
}
- .string {
- c.warn('use `str.contains(substr)` instead of `substr in str`', left_right_pos)
- c.check_expected(left_type, right_type) or {
- c.error('left operand to `$node.op` does not match: $err.msg',
- left_right_pos)
- }
- }
else {
c.error('`$node.op.str()` can only be used with an array/map/string',
node.pos)
diff --git a/vlib/v/checker/tests/alias_map_unknown_op_overloading_err.vv b/vlib/v/checker/tests/alias_map_unknown_op_overloading_err.vv
index bea0261c8b..e1332f8359 100644
--- a/vlib/v/checker/tests/alias_map_unknown_op_overloading_err.vv
+++ b/vlib/v/checker/tests/alias_map_unknown_op_overloading_err.vv
@@ -1,14 +1,14 @@
type Map = map[string]string
pub fn new_map() Map {
- return Map(map{
+ return Map({
'23': 'str'
})
}
fn (a Map) + (b Map) Map {
str := b['23']
- return Map(map{
+ return Map({
'34': str + '12'
})
}
diff --git a/vlib/v/checker/tests/array_or_map_assign_err.out b/vlib/v/checker/tests/array_or_map_assign_err.out
index fca758ba42..7931d926a7 100644
--- a/vlib/v/checker/tests/array_or_map_assign_err.out
+++ b/vlib/v/checker/tests/array_or_map_assign_err.out
@@ -11,10 +11,10 @@ vlib/v/checker/tests/array_or_map_assign_err.vv:5:5: error: use `array2 = array1
5 | a3 = a1
| ^
6 |
- 7 | m1 := map{'one': 1}
+ 7 | m1 := {'one': 1}
vlib/v/checker/tests/array_or_map_assign_err.vv:8:8: error: cannot copy map: call `move` or `clone` method (or use a reference)
6 |
- 7 | m1 := map{'one': 1}
+ 7 | m1 := {'one': 1}
8 | m2 := m1
| ~~
9 | mut m3 := map[string]int{}
diff --git a/vlib/v/checker/tests/array_or_map_assign_err.vv b/vlib/v/checker/tests/array_or_map_assign_err.vv
index 517a25d0b8..f2463c8001 100644
--- a/vlib/v/checker/tests/array_or_map_assign_err.vv
+++ b/vlib/v/checker/tests/array_or_map_assign_err.vv
@@ -4,7 +4,7 @@ fn main() {
mut a3 := []int{}
a3 = a1
- m1 := map{'one': 1}
+ m1 := {'one': 1}
m2 := m1
mut m3 := map[string]int{}
m3 = m1
@@ -12,7 +12,7 @@ fn main() {
_ = a2
_ = m2
- mut m := map{'foo':1}
+ mut m := {'foo':1}
foo(mut m)
_ = a3
diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_k.out b/vlib/v/checker/tests/assign_expr_undefined_err_k.out
index 0dd8e1ca2c..1ddc41103a 100644
--- a/vlib/v/checker/tests/assign_expr_undefined_err_k.out
+++ b/vlib/v/checker/tests/assign_expr_undefined_err_k.out
@@ -1,6 +1,6 @@
-vlib/v/checker/tests/assign_expr_undefined_err_k.vv:2:22: error: undefined variable: `a`
+vlib/v/checker/tests/assign_expr_undefined_err_k.vv:2:19: error: undefined variable: `a`
1 | fn main() {
- 2 | mut a := map{'one': a}
- | ^
+ 2 | mut a := {'one': a}
+ | ^
3 | println(a)
- 4 | }
+ 4 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/assign_expr_undefined_err_k.vv b/vlib/v/checker/tests/assign_expr_undefined_err_k.vv
index e4d1e89974..edca5cab84 100644
--- a/vlib/v/checker/tests/assign_expr_undefined_err_k.vv
+++ b/vlib/v/checker/tests/assign_expr_undefined_err_k.vv
@@ -1,4 +1,4 @@
fn main() {
- mut a := map{'one': a}
+ mut a := {'one': a}
println(a)
}
diff --git a/vlib/v/checker/tests/for_in_map_one_variable_err.out b/vlib/v/checker/tests/for_in_map_one_variable_err.out
index d7c6579ec2..0eb7516436 100644
--- a/vlib/v/checker/tests/for_in_map_one_variable_err.out
+++ b/vlib/v/checker/tests/for_in_map_one_variable_err.out
@@ -1,8 +1,8 @@
vlib/v/checker/tests/for_in_map_one_variable_err.vv:3:6: error: declare a key and a value variable when ranging a map: `for key, val in map {`
use `_` if you do not need the variable
1 | fn main() {
- 2 | kvs := map{'foo':'bar'}
+ 2 | kvs := {'foo':'bar'}
3 | for k in kvs {
| ^
4 | println('$k')
- 5 | }
+ 5 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/for_in_map_one_variable_err.vv b/vlib/v/checker/tests/for_in_map_one_variable_err.vv
index 9297280ec7..601c613df9 100644
--- a/vlib/v/checker/tests/for_in_map_one_variable_err.vv
+++ b/vlib/v/checker/tests/for_in_map_one_variable_err.vv
@@ -1,5 +1,5 @@
fn main() {
- kvs := map{'foo':'bar'}
+ kvs := {'foo':'bar'}
for k in kvs {
println('$k')
}
diff --git a/vlib/v/checker/tests/for_in_mut_val_type.out b/vlib/v/checker/tests/for_in_mut_val_type.out
index d898cf75a4..3a47a75493 100644
--- a/vlib/v/checker/tests/for_in_mut_val_type.out
+++ b/vlib/v/checker/tests/for_in_mut_val_type.out
@@ -14,7 +14,7 @@ vlib/v/checker/tests/for_in_mut_val_type.vv:7:15: error: `a2` is immutable, it c
9 | }
vlib/v/checker/tests/for_in_mut_val_type.vv:11:18: error: `m` is immutable, it cannot be changed
9 | }
- 10 | m := map{'aa': 1, 'bb': 2}
+ 10 | m := {'aa': 1, 'bb': 2}
11 | for _, mut j in m {
| ^
12 | j *= 2
@@ -33,10 +33,10 @@ vlib/v/checker/tests/for_in_mut_val_type.vv:17:15: error: array literal is immut
| ~~~~~~~~~~
18 | j *= 2
19 | }
-vlib/v/checker/tests/for_in_mut_val_type.vv:20:21: error: map literal is immutable, it cannot be changed
+vlib/v/checker/tests/for_in_mut_val_type.vv:20:18: error: map literal is immutable, it cannot be changed
18 | j *= 2
19 | }
- 20 | for _, mut j in map{'aa': 1, 'bb': 2} {
- | ~~~~~~~~~~~~~~~~~~
+ 20 | for _, mut j in {'aa': 1, 'bb': 2} {
+ | ~~~~~~~~~~~~~~~~~~
21 | j *= 2
22 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/for_in_mut_val_type.vv b/vlib/v/checker/tests/for_in_mut_val_type.vv
index 664fb66cf8..afd714bdf5 100644
--- a/vlib/v/checker/tests/for_in_mut_val_type.vv
+++ b/vlib/v/checker/tests/for_in_mut_val_type.vv
@@ -7,7 +7,7 @@ fn main() {
for mut j in a2 {
j *= 2
}
- m := map{'aa': 1, 'bb': 2}
+ m := {'aa': 1, 'bb': 2}
for _, mut j in m {
j *= 2
}
@@ -17,7 +17,7 @@ fn main() {
for mut j in [1, 2, 3]! {
j *= 2
}
- for _, mut j in map{'aa': 1, 'bb': 2} {
+ for _, mut j in {'aa': 1, 'bb': 2} {
j *= 2
}
}
diff --git a/vlib/v/checker/tests/import_symbol_private_err.out b/vlib/v/checker/tests/import_symbol_private_err.out
index 2d3d1e2c98..578d96a3e2 100644
--- a/vlib/v/checker/tests/import_symbol_private_err.out
+++ b/vlib/v/checker/tests/import_symbol_private_err.out
@@ -10,10 +10,10 @@ vlib/v/checker/tests/import_symbol_private_err.vv:4:13: error: module `io` type
3 | import time { now, since }
4 | import io { ReaderWriterImpl }
| ~~~~~~~~~~~~~~~~
- 5 |
+ 5 |
6 | fn main() {
vlib/v/checker/tests/import_symbol_private_err.vv:7:18: error: constant `v.scanner.single_quote` is private
- 5 |
+ 5 |
6 | fn main() {
7 | println(scanner.single_quote)
| ~~~~~~~~~~~~
@@ -25,24 +25,24 @@ vlib/v/checker/tests/import_symbol_private_err.vv:8:17: error: enum `v.parser.St
8 | println(parser.State.html)
| ~~~~~~~~~~
9 | since(now())
- 10 | _ = map{'h': 2}.exists('h')
+ 10 | _ = {'h': 2}.exists('h')
vlib/v/checker/tests/import_symbol_private_err.vv:9:2: error: function `time.since` is private
7 | println(scanner.single_quote)
8 | println(parser.State.html)
9 | since(now())
| ~~~~~~~~~~~~
- 10 | _ = map{'h': 2}.exists('h')
+ 10 | _ = {'h': 2}.exists('h')
11 | _ = ReaderWriterImpl{}
-vlib/v/checker/tests/import_symbol_private_err.vv:10:18: error: method `map[string]int.exists` is private
+vlib/v/checker/tests/import_symbol_private_err.vv:10:15: error: method `map[string]int.exists` is private
8 | println(parser.State.html)
9 | since(now())
- 10 | _ = map{'h': 2}.exists('h')
- | ~~~~~~~~~~~
+ 10 | _ = {'h': 2}.exists('h')
+ | ~~~~~~~~~~~
11 | _ = ReaderWriterImpl{}
12 | }
vlib/v/checker/tests/import_symbol_private_err.vv:11:6: error: type `io.ReaderWriterImpl` is private
9 | since(now())
- 10 | _ = map{'h': 2}.exists('h')
+ 10 | _ = {'h': 2}.exists('h')
11 | _ = ReaderWriterImpl{}
| ~~~~~~~~~~~~~~~~~~
- 12 | }
+ 12 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/import_symbol_private_err.vv b/vlib/v/checker/tests/import_symbol_private_err.vv
index 0957e86238..fd4411b0e7 100644
--- a/vlib/v/checker/tests/import_symbol_private_err.vv
+++ b/vlib/v/checker/tests/import_symbol_private_err.vv
@@ -7,6 +7,6 @@ fn main() {
println(scanner.single_quote)
println(parser.State.html)
since(now())
- _ = map{'h': 2}.exists('h')
+ _ = {'h': 2}.exists('h')
_ = ReaderWriterImpl{}
}
diff --git a/vlib/v/checker/tests/in_mismatch_type.out b/vlib/v/checker/tests/in_mismatch_type.out
index d6e9e12d86..1a3b16c491 100644
--- a/vlib/v/checker/tests/in_mismatch_type.out
+++ b/vlib/v/checker/tests/in_mismatch_type.out
@@ -12,18 +12,18 @@ vlib/v/checker/tests/in_mismatch_type.vv:13:5: error: left operand to `in` does
| ~~~~~~
14 | println('yeah')
15 | }
-vlib/v/checker/tests/in_mismatch_type.vv:16:5: error: use `str.contains(substr)` instead of `substr in str`
+vlib/v/checker/tests/in_mismatch_type.vv:16:7: error: `in` can only be used with an array/map/string
14 | println('yeah')
15 | }
16 | if 3 in s {
- | ~~~~~~
+ | ~~
17 | println('dope')
18 | }
-vlib/v/checker/tests/in_mismatch_type.vv:19:5: error: use `str.contains(substr)` instead of `substr in str`
+vlib/v/checker/tests/in_mismatch_type.vv:19:9: error: `in` can only be used with an array/map/string
17 | println('dope')
18 | }
19 | if `a` in s {
- | ~~~~~~~~
+ | ~~
20 | println("oh no :'(")
21 | }
vlib/v/checker/tests/in_mismatch_type.vv:22:7: error: `in` can only be used with an array/map/string
@@ -74,4 +74,4 @@ vlib/v/checker/tests/in_mismatch_type.vv:41:5: error: left operand to `!in` does
41 | if 5 !in m {
| ~~~~~~~
42 | println('yay')
- 43 | }
+ 43 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/in_mismatch_type.vv b/vlib/v/checker/tests/in_mismatch_type.vv
index 4a5dc697c3..2fc2bde89e 100644
--- a/vlib/v/checker/tests/in_mismatch_type.vv
+++ b/vlib/v/checker/tests/in_mismatch_type.vv
@@ -3,7 +3,7 @@ type Int = int
fn main() {
a_i := [1, 2, 3]
a_s := ['1', '2', '3']
- m := map{
+ m := {
'test': 1
}
s := 'abcd'
diff --git a/vlib/v/checker/tests/map_delete.out b/vlib/v/checker/tests/map_delete.out
index c3a1822113..ecfbca0e21 100644
--- a/vlib/v/checker/tests/map_delete.out
+++ b/vlib/v/checker/tests/map_delete.out
@@ -4,13 +4,13 @@ vlib/v/checker/tests/map_delete.vv:5:11: error: cannot use `int literal` as `str
5 | m.delete(1)
| ^
6 | m.delete(1, 2)
- 7 | m2 := map{
+ 7 | m2 := {
vlib/v/checker/tests/map_delete.vv:6:4: error: expected 1 argument, but got 2
4 | }
5 | m.delete(1)
6 | m.delete(1, 2)
| ~~~~~~~~~~~~
- 7 | m2 := map{
+ 7 | m2 := {
8 | '1': 1
vlib/v/checker/tests/map_delete.vv:10:2: error: `m2` is immutable, declare it with `mut` to make it mutable
8 | '1': 1
diff --git a/vlib/v/checker/tests/map_delete.vv b/vlib/v/checker/tests/map_delete.vv
index 26b26067c4..c9cd093b90 100644
--- a/vlib/v/checker/tests/map_delete.vv
+++ b/vlib/v/checker/tests/map_delete.vv
@@ -1,10 +1,10 @@
fn main() {
- mut m := map{
+ mut m := {
'1': 1
}
m.delete(1)
m.delete(1, 2)
- m2 := map{
+ m2 := {
'1': 1
}
m2.delete('1')
diff --git a/vlib/v/checker/tests/map_init_invalid_syntax.out b/vlib/v/checker/tests/map_init_invalid_syntax.out
index e18f40dc95..c7fec6d947 100644
--- a/vlib/v/checker/tests/map_init_invalid_syntax.out
+++ b/vlib/v/checker/tests/map_init_invalid_syntax.out
@@ -1,6 +1,6 @@
-vlib/v/checker/tests/map_init_invalid_syntax.vv:2:10: error: invalid empty map initilization syntax, use e.g. map[string]int{} instead
+vlib/v/checker/tests/map_init_invalid_syntax.vv:2:7: error: invalid empty map initilization syntax, use e.g. map[string]int{} instead
1 | fn main() {
- 2 | a := map{}
- | ~~
+ 2 | a := {}
+ | ~~
3 | println(a)
- 4 | }
+ 4 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/map_init_invalid_syntax.vv b/vlib/v/checker/tests/map_init_invalid_syntax.vv
index a976d70a52..cf83b10840 100644
--- a/vlib/v/checker/tests/map_init_invalid_syntax.vv
+++ b/vlib/v/checker/tests/map_init_invalid_syntax.vv
@@ -1,4 +1,4 @@
fn main() {
- a := map{}
+ a := {}
println(a)
}
diff --git a/vlib/v/checker/tests/map_init_key_duplicate_err.out b/vlib/v/checker/tests/map_init_key_duplicate_err.out
index d560b64116..61c061ee89 100644
--- a/vlib/v/checker/tests/map_init_key_duplicate_err.out
+++ b/vlib/v/checker/tests/map_init_key_duplicate_err.out
@@ -5,9 +5,9 @@ vlib/v/checker/tests/map_init_key_duplicate_err.vv:5:3: error: duplicate key "fo
| ~~~~~
6 | }
7 | println(a)
-vlib/v/checker/tests/map_init_key_duplicate_err.vv:9:18: error: duplicate key "2" in map literal
+vlib/v/checker/tests/map_init_key_duplicate_err.vv:9:15: error: duplicate key "2" in map literal
7 | println(a)
8 |
- 9 | _ = map{2:0 3:0 2:0}
- | ^
+ 9 | _ = {2:0 3:0 2:0}
+ | ^
10 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/map_init_key_duplicate_err.vv b/vlib/v/checker/tests/map_init_key_duplicate_err.vv
index cd6efe6663..2309e1f0fc 100644
--- a/vlib/v/checker/tests/map_init_key_duplicate_err.vv
+++ b/vlib/v/checker/tests/map_init_key_duplicate_err.vv
@@ -1,10 +1,10 @@
fn main() {
- a := map{
+ a := {
'foo': 'bar'
'abc': 'abc'
'foo': 'bar'
}
println(a)
- _ = map{2:0 3:0 2:0}
+ _ = {2:0 3:0 2:0}
}
diff --git a/vlib/v/checker/tests/map_init_wrong_type.out b/vlib/v/checker/tests/map_init_wrong_type.out
index 117e787c9c..d58d7f88dc 100644
--- a/vlib/v/checker/tests/map_init_wrong_type.out
+++ b/vlib/v/checker/tests/map_init_wrong_type.out
@@ -1,21 +1,21 @@
-vlib/v/checker/tests/map_init_wrong_type.vv:3:18: error: invalid map value: expected `f32`, not `float literal`
+vlib/v/checker/tests/map_init_wrong_type.vv:3:15: error: invalid map value: expected `f32`, not `float literal`
1 | fn main() {
2 | mut a := map[string]f32{}
- 3 | a = map{ 'x': 12.3 }
- | ~~~~
- 4 | _ = map{2:0 3:0 "hi":0}
- 5 | _ = map{2:0 3:`@` 4:0}
-vlib/v/checker/tests/map_init_wrong_type.vv:4:20: error: invalid map key: expected `int`, not `string`
+ 3 | a = { 'x': 12.3 }
+ | ~~~~
+ 4 | _ = {2:0 3:0 "hi":0}
+ 5 | _ = {2:0 3:`@` 4:0}
+vlib/v/checker/tests/map_init_wrong_type.vv:4:17: error: invalid map key: expected `int`, not `string`
2 | mut a := map[string]f32{}
- 3 | a = map{ 'x': 12.3 }
- 4 | _ = map{2:0 3:0 "hi":0}
- | ~~~~
- 5 | _ = map{2:0 3:`@` 4:0}
+ 3 | a = { 'x': 12.3 }
+ 4 | _ = {2:0 3:0 "hi":0}
+ | ~~~~
+ 5 | _ = {2:0 3:`@` 4:0}
6 | _ = a
-vlib/v/checker/tests/map_init_wrong_type.vv:5:18: error: invalid map value: expected `int`, not `rune`
- 3 | a = map{ 'x': 12.3 }
- 4 | _ = map{2:0 3:0 "hi":0}
- 5 | _ = map{2:0 3:`@` 4:0}
- | ~~~
+vlib/v/checker/tests/map_init_wrong_type.vv:5:15: error: invalid map value: expected `int`, not `rune`
+ 3 | a = { 'x': 12.3 }
+ 4 | _ = {2:0 3:0 "hi":0}
+ 5 | _ = {2:0 3:`@` 4:0}
+ | ~~~
6 | _ = a
7 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/map_init_wrong_type.vv b/vlib/v/checker/tests/map_init_wrong_type.vv
index dc41230625..56b7b960f3 100644
--- a/vlib/v/checker/tests/map_init_wrong_type.vv
+++ b/vlib/v/checker/tests/map_init_wrong_type.vv
@@ -1,7 +1,7 @@
fn main() {
mut a := map[string]f32{}
- a = map{ 'x': 12.3 }
- _ = map{2:0 3:0 "hi":0}
- _ = map{2:0 3:`@` 4:0}
+ a = { 'x': 12.3 }
+ _ = {2:0 3:0 "hi":0}
+ _ = {2:0 3:`@` 4:0}
_ = a
}
diff --git a/vlib/v/checker/tests/mut_map_get_value_address_err.out b/vlib/v/checker/tests/mut_map_get_value_address_err.out
index 297c22825c..1e58a504bf 100644
--- a/vlib/v/checker/tests/mut_map_get_value_address_err.out
+++ b/vlib/v/checker/tests/mut_map_get_value_address_err.out
@@ -1,7 +1,7 @@
vlib/v/checker/tests/mut_map_get_value_address_err.vv:3:12: error: cannot take the address of map values
1 | fn main() {
- 2 | mut m := map{'key' : 3}
+ 2 | mut m := {'key' : 3}
3 | a := &m['key']
| ~~~~~~~
4 | println(a)
- 5 | }
+ 5 | }
\ No newline at end of file
diff --git a/vlib/v/checker/tests/mut_map_get_value_address_err.vv b/vlib/v/checker/tests/mut_map_get_value_address_err.vv
index 46e5b771af..1f3cc58a9d 100644
--- a/vlib/v/checker/tests/mut_map_get_value_address_err.vv
+++ b/vlib/v/checker/tests/mut_map_get_value_address_err.vv
@@ -1,5 +1,5 @@
fn main() {
- mut m := map{'key' : 3}
+ mut m := {'key' : 3}
a := &m['key']
println(a)
}
diff --git a/vlib/v/checker/tests/or_expr_types_mismatch.out b/vlib/v/checker/tests/or_expr_types_mismatch.out
index c84faa59bd..352b56b85d 100644
--- a/vlib/v/checker/tests/or_expr_types_mismatch.out
+++ b/vlib/v/checker/tests/or_expr_types_mismatch.out
@@ -1,6 +1,6 @@
vlib/v/checker/tests/or_expr_types_mismatch.vv:3:19: error: wrong return type `none` in the `or {}` block, expected `string`
1 | fn get_map() ?string {
- 2 | m := map{1: 'a', 2: 'b'}
+ 2 | m := {1: 'a', 2: 'b'}
3 | return m[1] or { none }
| ~~~~
4 | }
diff --git a/vlib/v/checker/tests/or_expr_types_mismatch.vv b/vlib/v/checker/tests/or_expr_types_mismatch.vv
index 1b557c3695..ab5f1c8b1f 100644
--- a/vlib/v/checker/tests/or_expr_types_mismatch.vv
+++ b/vlib/v/checker/tests/or_expr_types_mismatch.vv
@@ -1,5 +1,5 @@
fn get_map() ?string {
- m := map{1: 'a', 2: 'b'}
+ m := {1: 'a', 2: 'b'}
return m[1] or { none }
}
diff --git a/vlib/v/checker/tests/shared_bad_args.vv b/vlib/v/checker/tests/shared_bad_args.vv
index f0d4913491..08e5d8a69b 100644
--- a/vlib/v/checker/tests/shared_bad_args.vv
+++ b/vlib/v/checker/tests/shared_bad_args.vv
@@ -37,7 +37,7 @@ fn a_val(a []int) int {
fn test_shared_as_value() {
shared s := St{ a: 5 }
shared a := [3, 4, 6, 13, -23]
- shared m := map{'qw': 12.75, 'yxcv': -3.125, 'poiu': 88.0625}
+ shared m := {'qw': 12.75, 'yxcv': -3.125, 'poiu': 88.0625}
shared r := Qr{ a: 7 }
lock s {
u := r.s_val(s)
@@ -55,7 +55,7 @@ fn test_shared_as_value() {
fn test_shared_as_mut() {
shared s := St{ a: 5 }
shared a := [3, 4, 6, 13, -23]
- shared m := map{'qw': 12.75, 'yxcv': -3.125, 'poiu': 88.0625}
+ shared m := {'qw': 12.75, 'yxcv': -3.125, 'poiu': 88.0625}
shared r := Qr{ a: 7 }
lock s {
r.s_mut(mut s)
diff --git a/vlib/v/checker/tests/struct_short_init_warning.out b/vlib/v/checker/tests/struct_short_init_warning.out
deleted file mode 100644
index 41daa52c03..0000000000
--- a/vlib/v/checker/tests/struct_short_init_warning.out
+++ /dev/null
@@ -1,13 +0,0 @@
-vlib/v/checker/tests/struct_short_init_warning.vv:6:9: warning: short struct initalization is deprecated, use explicit struct name
- 4 |
- 5 | fn f(foo Foo) Foo {
- 6 | return {v: foo.v}
- | ~~~~~~~~~~
- 7 | }
- 8 |
-vlib/v/checker/tests/struct_short_init_warning.vv:10:4: warning: short struct initalization is deprecated, use explicit struct name
- 8 |
- 9 | fn main() {
- 10 | f({v: 10})
- | ~~~~~~~
- 11 | }
diff --git a/vlib/v/checker/tests/struct_short_init_warning.vv b/vlib/v/checker/tests/struct_short_init_warning.vv
deleted file mode 100644
index 74bd02ff10..0000000000
--- a/vlib/v/checker/tests/struct_short_init_warning.vv
+++ /dev/null
@@ -1,11 +0,0 @@
-struct Foo {
- v int
-}
-
-fn f(foo Foo) Foo {
- return {v: foo.v}
-}
-
-fn main() {
- f({v: 10})
-}
diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v
index 316cd333da..3149439804 100644
--- a/vlib/v/doc/doc.v
+++ b/vlib/v/doc/doc.v
@@ -279,7 +279,7 @@ pub fn (mut d Doc) stmt(stmt ast.Stmt, filename string) ?DocNode {
kind: .variable
parent_name: node.name
pos: param.pos
- attrs: map{
+ attrs: {
'mut': param.is_mut.str()
}
return_type: d.type_to_str(param.typ)
diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v
index 6de223af56..830d878226 100644
--- a/vlib/v/fmt/fmt.v
+++ b/vlib/v/fmt/fmt.v
@@ -1970,14 +1970,11 @@ pub fn (mut f Fmt) map_init(node ast.MapInit) {
info := sym.info as ast.Map
f.mark_types_import_as_used(info.key_type)
f.write(f.table.type_to_str_using_aliases(node.typ, f.mod2alias))
- } else {
- // m = map{}
- f.write('map')
}
f.write('{}')
return
}
- f.writeln('map{')
+ f.writeln('{')
f.indent++
f.comments(node.pre_cmnts)
mut max_field_len := 0
diff --git a/vlib/v/fmt/tests/array_init_comment_ending_keep.vv b/vlib/v/fmt/tests/array_init_comment_ending_keep.vv
index 9fe7624f4e..fdbf675e85 100644
--- a/vlib/v/fmt/tests/array_init_comment_ending_keep.vv
+++ b/vlib/v/fmt/tests/array_init_comment_ending_keep.vv
@@ -3,7 +3,7 @@ import net.http
const (
write_set_cookie_tests = [
ReadSetCookiesTestCase{
- header: map{
+ header: {
'Set-Cookie': ['special-7=","']
}
cookies: [
diff --git a/vlib/v/fmt/tests/array_init_keep.vv b/vlib/v/fmt/tests/array_init_keep.vv
index 3888cc4ea0..8321e2e074 100644
--- a/vlib/v/fmt/tests/array_init_keep.vv
+++ b/vlib/v/fmt/tests/array_init_keep.vv
@@ -1,9 +1,9 @@
fn main() {
_ := []int{len: 10, cap: 10, init: 7}
- _ := []map[string]string{len: 5, cap: 50, init: map{
+ _ := []map[string]string{len: 5, cap: 50, init: {
'a': 'a'
}}
- _ := []map[string][]int{len: 7, cap: 100, init: map{
+ _ := []map[string][]int{len: 7, cap: 100, init: {
'a': [1, 2]
}}
}
diff --git a/vlib/v/fmt/tests/comments_keep.vv b/vlib/v/fmt/tests/comments_keep.vv
index a581eb2c35..5af72801aa 100644
--- a/vlib/v/fmt/tests/comments_keep.vv
+++ b/vlib/v/fmt/tests/comments_keep.vv
@@ -70,7 +70,7 @@ fn linebreaks_in_ascii_art_block_comments() {
}
fn map_comments() {
- mymap := map{
+ mymap := {
// pre
`:`: 1
`!`: 2 // after
diff --git a/vlib/v/fmt/tests/empty_lines_keep.vv b/vlib/v/fmt/tests/empty_lines_keep.vv
index afcd1e55df..7e22486423 100644
--- a/vlib/v/fmt/tests/empty_lines_keep.vv
+++ b/vlib/v/fmt/tests/empty_lines_keep.vv
@@ -80,7 +80,7 @@ fn no_empty_lines() {
mut files := map[string][]FileData{}
code := 'foo
bar'
- params[0] = {
+ params[0] = IfExpr{
...params[0]
typ: params[0].typ.set_nr_muls(1)
}
diff --git a/vlib/v/fmt/tests/fn_return_generic_struct_keep.vv b/vlib/v/fmt/tests/fn_return_generic_struct_keep.vv
index b85781e118..abbc861ee4 100644
--- a/vlib/v/fmt/tests/fn_return_generic_struct_keep.vv
+++ b/vlib/v/fmt/tests/fn_return_generic_struct_keep.vv
@@ -9,7 +9,7 @@ pub struct Foo {
}
pub fn (f Foo) new_some(value T) Optional {
- return {
+ return Optional{
value: value
some: true
}
diff --git a/vlib/v/fmt/tests/fn_trailing_arg_syntax_expected.vv b/vlib/v/fmt/tests/fn_trailing_arg_syntax_expected.vv
index 255d5ca579..f082c1356e 100644
--- a/vlib/v/fmt/tests/fn_trailing_arg_syntax_expected.vv
+++ b/vlib/v/fmt/tests/fn_trailing_arg_syntax_expected.vv
@@ -22,8 +22,8 @@ fn main() {
y: 0
}
)
- bar2_func({})
- bar2_func({ x: 's' },
+ bar2_func()
+ bar2_func(Bar{ x: 's' },
x: 's'
)
baz_func('foo', 'bar',
@@ -32,7 +32,7 @@ fn main() {
)
ui.row(
// stretch: true
- margin: {
+ margin: Margin{
top: 10
left: 10
right: 10
diff --git a/vlib/v/fmt/tests/fn_trailing_arg_syntax_input.vv b/vlib/v/fmt/tests/fn_trailing_arg_syntax_input.vv
index 110161985a..a42259fb3f 100644
--- a/vlib/v/fmt/tests/fn_trailing_arg_syntax_input.vv
+++ b/vlib/v/fmt/tests/fn_trailing_arg_syntax_input.vv
@@ -16,15 +16,15 @@ fn main() {
x: 0
y: 0
})
- bar2_func({})
- bar2_func({x: 's'}, {x: 's'})
+ bar2_func()
+ bar2_func(Bar{x: 's'}, x: 's')
baz_func('foo', 'bar', x: 0
y: 0
)
- ui.row({
+ ui.row(
//stretch: true
- margin: {top:10,left:10,right:10,bottom:10}
- })
+ margin: Margin{top:10,left:10,right:10,bottom:10}
+ )
}
fn bar_func(bar Bar) {
diff --git a/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv b/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv
index 9a9d98c2c6..dc76db48ce 100644
--- a/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv
+++ b/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv
@@ -52,6 +52,5 @@ fn main() {
}
fn trailing_struct_with_update_expr() {
- c.error('duplicate const `$field.name`', { ...field.pos, len: name_len })
c.error('duplicate const `$field.name`', Position{ ...field.pos, len: name_len })
}
diff --git a/vlib/v/fmt/tests/import_selective_expected.vv b/vlib/v/fmt/tests/import_selective_expected.vv
index 8cdb26a964..fa72af77f1 100644
--- a/vlib/v/fmt/tests/import_selective_expected.vv
+++ b/vlib/v/fmt/tests/import_selective_expected.vv
@@ -28,7 +28,7 @@ struct Struct {
}
fn (s Struct) method(v StructMethodArg) StructMethodRet {
- return {}
+ return StructMethodRet{}
}
interface Interface {
@@ -43,7 +43,7 @@ fn f(v FnArg) FnRet {
println(Enum.val)
- return {}
+ return FnRet{}
}
struct App {
diff --git a/vlib/v/fmt/tests/import_selective_input.vv b/vlib/v/fmt/tests/import_selective_input.vv
index 12a08125ea..534b72e593 100644
--- a/vlib/v/fmt/tests/import_selective_input.vv
+++ b/vlib/v/fmt/tests/import_selective_input.vv
@@ -33,7 +33,7 @@ struct Struct {
}
fn (s Struct) method(v StructMethodArg) StructMethodRet {
- return {}
+ return StructMethodRet{}
}
interface Interface {
@@ -47,7 +47,7 @@ fn f(v FnArg) FnRet {
println(Enum.val)
- return {}
+ return FnRet{}
}
struct App {
diff --git a/vlib/v/fmt/tests/maps_expected.vv b/vlib/v/fmt/tests/maps_expected.vv
index ade554fc22..122114a299 100644
--- a/vlib/v/fmt/tests/maps_expected.vv
+++ b/vlib/v/fmt/tests/maps_expected.vv
@@ -1,5 +1,5 @@
const (
- reserved_types = map{
+ reserved_types = {
'i8': true
'i16': true
'int': true
@@ -8,7 +8,7 @@ const (
}
)
-numbers := map{
+numbers := {
'one': 1
'two': 2
'sevenhundredseventyseven': 777
diff --git a/vlib/v/fmt/tests/maps_keep.vv b/vlib/v/fmt/tests/maps_keep.vv
index e2cbf1efc8..b5737f7077 100644
--- a/vlib/v/fmt/tests/maps_keep.vv
+++ b/vlib/v/fmt/tests/maps_keep.vv
@@ -5,11 +5,11 @@ fn workaround() {
fn main() {
mut ams := []map[string]string{}
- ams << map{
+ ams << {
'a': 'b'
'c': 'd'
}
- ams << map{
+ ams << {
'e': 'f'
'g': 'h'
}
diff --git a/vlib/v/fmt/tests/maps_of_fns_with_string_keys_keep.vv b/vlib/v/fmt/tests/maps_of_fns_with_string_keys_keep.vv
index bcb6affb0d..30829ded38 100644
--- a/vlib/v/fmt/tests/maps_of_fns_with_string_keys_keep.vv
+++ b/vlib/v/fmt/tests/maps_of_fns_with_string_keys_keep.vv
@@ -5,7 +5,7 @@ fn sqr(n int) int {
fn main() {
fns := [sqr]
println(fns[0](10))
- fns_map := map{
+ fns_map := {
'sqr': sqr
}
println(fns_map['sqr'])
diff --git a/vlib/v/gen/js/tests/array.v b/vlib/v/gen/js/tests/array.v
index f07e1b65a2..b8f1f2da50 100644
--- a/vlib/v/gen/js/tests/array.v
+++ b/vlib/v/gen/js/tests/array.v
@@ -73,8 +73,6 @@ fn main() {
println('key' in m)
print('true\t=> ')
println('badkey' !in m)
- print('true\t=> ')
- println('o' in 'hello')
// for in
for _ in arr1 {}
diff --git a/vlib/v/gen/js/tests/js.v b/vlib/v/gen/js/tests/js.v
index ee7ba084ec..90bcb189ab 100644
--- a/vlib/v/gen/js/tests/js.v
+++ b/vlib/v/gen/js/tests/js.v
@@ -71,7 +71,7 @@ fn main() {
arr := [1, 2, 3, 4, 5]
for i in arr {
}
- ma := map{
+ ma := {
'str': 'done'
'ddo': 'baba'
}
diff --git a/vlib/v/parser/expr.v b/vlib/v/parser/expr.v
index 746e928764..3317b4760c 100644
--- a/vlib/v/parser/expr.v
+++ b/vlib/v/parser/expr.v
@@ -50,6 +50,8 @@ pub fn (mut p Parser) check_expr(precedence int) ?ast.Expr {
p.inside_match = false
} else if p.tok.lit == 'map' && p.peek_tok.kind == .lcbr && !(p.builtin_mod
&& p.file_base in ['map.v', 'map_d_gcboehm_opt.v']) {
+ p.warn_with_pos("deprecated map syntax, use syntax like `{'age': 20}`",
+ p.tok.position())
p.next() // `map`
p.next() // `{`
node = p.map_init()
@@ -297,33 +299,9 @@ pub fn (mut p Parser) check_expr(precedence int) ?ast.Expr {
}
}
.lcbr {
- // TODO: remove this when deprecation will be removed, vfmt should handle it for a while
- // Map `{"age": 20}` or `{ x | foo:bar, a:10 }`
+ // Map `{"age": 20}`
p.next()
- if p.tok.kind in [.chartoken, .number, .string] {
- p.warn_with_pos("deprecated map syntax, use syntax like `map{'age': 20}`",
- p.prev_tok.position())
- node = p.map_init()
- } else {
- // it should be a struct
- if p.tok.kind == .name && p.peek_tok.kind == .pipe {
- // TODO: remove deprecated
- p.warn_with_pos('use e.g. `...struct_var` instead', p.peek_tok.position())
- node = p.assoc()
- } else if (p.tok.kind == .name && p.peek_tok.kind == .colon)
- || p.tok.kind in [.rcbr, .comment, .ellipsis] {
- node = p.struct_init(true) // short_syntax: true
- p.warn_with_pos('short struct initalization is deprecated, use explicit struct name',
- node.position())
- } else if p.tok.kind == .name {
- p.next()
- return p.error_with_pos('unexpected $p.tok, expecting `:` after struct field name',
- p.tok.position())
- } else {
- return p.error_with_pos('unexpected $p.tok, expecting struct field name',
- p.tok.position())
- }
- }
+ node = p.map_init()
p.check(.rcbr)
}
.key_fn {
diff --git a/vlib/v/parser/tests/for_in_mut_key_of_map.out b/vlib/v/parser/tests/for_in_mut_key_of_map.out
index 6737a534da..7c159a0338 100644
--- a/vlib/v/parser/tests/for_in_mut_key_of_map.out
+++ b/vlib/v/parser/tests/for_in_mut_key_of_map.out
@@ -1,6 +1,6 @@
vlib/v/parser/tests/for_in_mut_key_of_map.vv:3:6: error: index of array or key of map cannot be mutated
1 | fn main() {
- 2 | mut m := map{'foo': 1, 'bar': 2}
+ 2 | mut m := {'foo': 1, 'bar': 2}
3 | for mut k, _ in m {
| ~~~
4 | println(k)
diff --git a/vlib/v/parser/tests/for_in_mut_key_of_map.vv b/vlib/v/parser/tests/for_in_mut_key_of_map.vv
index c8a2296983..22a5acade0 100644
--- a/vlib/v/parser/tests/for_in_mut_key_of_map.vv
+++ b/vlib/v/parser/tests/for_in_mut_key_of_map.vv
@@ -1,5 +1,5 @@
fn main() {
- mut m := map{'foo': 1, 'bar': 2}
+ mut m := {'foo': 1, 'bar': 2}
for mut k, _ in m {
println(k)
}
diff --git a/vlib/v/parser/tests/or_default_missing.vv b/vlib/v/parser/tests/or_default_missing.vv
index ad9fa62988..d89db0d72e 100644
--- a/vlib/v/parser/tests/or_default_missing.vv
+++ b/vlib/v/parser/tests/or_default_missing.vv
@@ -7,7 +7,7 @@ fn test_array_or() {
}
fn test_map_or() {
- m := map{
+ m := {
'as': 3
'qw': 4
'kl': 5
diff --git a/vlib/v/parser/tests/struct_field_expected.out b/vlib/v/parser/tests/struct_field_expected.out
index 9fa06a2d95..0aabfbeb0f 100644
--- a/vlib/v/parser/tests/struct_field_expected.out
+++ b/vlib/v/parser/tests/struct_field_expected.out
@@ -1,7 +1,7 @@
-vlib/v/parser/tests/struct_field_expected.vv:6:2: error: unexpected token `.`, expecting struct field name
- 4 |
- 5 | x = {
- 6 | .a : 'Alpha'
- | ^
- 7 | .b : 'Beta'
- 8 | }
+vlib/v/parser/tests/struct_field_expected.vv:6:4: error: invalid expression: unexpected token `:`
+ 4 |
+ 5 | x = Bar{
+ 6 | .a: 'Alpha'
+ | ^
+ 7 | .b: 'Beta'
+ 8 | }
\ No newline at end of file
diff --git a/vlib/v/parser/tests/struct_field_expected.vv b/vlib/v/parser/tests/struct_field_expected.vv
index bf4929cded..c17731123f 100644
--- a/vlib/v/parser/tests/struct_field_expected.vv
+++ b/vlib/v/parser/tests/struct_field_expected.vv
@@ -2,8 +2,8 @@ enum TestEnum {
a b
}
-x = {
- .a : 'Alpha'
- .b : 'Beta'
+x = Bar{
+ .a: 'Alpha'
+ .b: 'Beta'
}
diff --git a/vlib/v/pkgconfig/pkgconfig_test.v b/vlib/v/pkgconfig/pkgconfig_test.v
index 4bc0db6191..0d7204ee17 100644
--- a/vlib/v/pkgconfig/pkgconfig_test.v
+++ b/vlib/v/pkgconfig/pkgconfig_test.v
@@ -55,7 +55,7 @@ fn test_samples() {
assert x.cflags == ['-I/usr/include', '-pthread', '-I/usr/include/glib-2.0',
'-I/usr/lib/x86_64-linux-gnu/glib-2.0/include',
]
- assert x.vars == map{
+ assert x.vars == {
'prefix': '/usr'
'libdir': '/usr/lib/x86_64-linux-gnu'
'includedir': '/usr/include'
@@ -74,7 +74,7 @@ fn test_samples() {
assert x.libs_private == ['-pthread']
assert x.cflags == ['-I/usr/include/glib-2.0',
'-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include']
- assert x.vars == map{
+ assert x.vars == {
'prefix': '/usr'
'libdir': '/usr/lib/x86_64-linux-gnu'
'includedir': '/usr/include'
diff --git a/vlib/v/tests/alias_custom_type_map_test.v b/vlib/v/tests/alias_custom_type_map_test.v
index dd2bcd7492..492e1810cb 100644
--- a/vlib/v/tests/alias_custom_type_map_test.v
+++ b/vlib/v/tests/alias_custom_type_map_test.v
@@ -1,7 +1,7 @@
import geometry
fn test_aliases_map_init() {
- a := geometry.ShapeMap(map{
+ a := geometry.ShapeMap({
geometry.Shape.circle: 'Shape is a circle.'
})
assert a[geometry.Shape.circle] == 'Shape is a circle.'
diff --git a/vlib/v/tests/alias_map_operator_overloading_test.v b/vlib/v/tests/alias_map_operator_overloading_test.v
index 14ad50ffff..4dcf61e747 100644
--- a/vlib/v/tests/alias_map_operator_overloading_test.v
+++ b/vlib/v/tests/alias_map_operator_overloading_test.v
@@ -1,14 +1,14 @@
type Map = map[string]string
pub fn new_map() Map {
- return Map(map{
+ return Map({
'23': 'str'
})
}
fn (a Map) + (b Map) Map {
str := b['23']
- return Map(map{
+ return Map({
'34': str + '12'
})
}
@@ -16,7 +16,7 @@ fn (a Map) + (b Map) Map {
fn test_map_alias_op_overloading() {
a := new_map()
b := new_map()
- assert a + b == Map(map{
+ assert a + b == Map({
'34': 'str12'
})
assert '${a + b}' == "Map({'34': 'str12'})"
diff --git a/vlib/v/tests/anon_fn_in_containers_test.v b/vlib/v/tests/anon_fn_in_containers_test.v
index 808838afab..7c7720b0dd 100644
--- a/vlib/v/tests/anon_fn_in_containers_test.v
+++ b/vlib/v/tests/anon_fn_in_containers_test.v
@@ -1,5 +1,5 @@
fn test_anon_fn_in_map() {
- mut woop := map{
+ mut woop := {
'what': fn () string {
return 'whoopity whoop'
}
diff --git a/vlib/v/tests/array_append_short_struct_test.v b/vlib/v/tests/array_append_short_struct_test.v
index 293e9d5683..99a6fb1388 100644
--- a/vlib/v/tests/array_append_short_struct_test.v
+++ b/vlib/v/tests/array_append_short_struct_test.v
@@ -4,7 +4,7 @@ struct Page {
fn test_array_append_short_struct() {
mut pages := []Page{}
- pages << {
+ pages << Page{
contents: 3
}
println(pages)
diff --git a/vlib/v/tests/array_map_or_test.v b/vlib/v/tests/array_map_or_test.v
index 6c46382edc..1e62c74509 100644
--- a/vlib/v/tests/array_map_or_test.v
+++ b/vlib/v/tests/array_map_or_test.v
@@ -32,7 +32,7 @@ fn test_array_or_direct() {
}
fn test_map_or() {
- m := map{
+ m := {
'as': 3
'qw': 4
'kl': 5
@@ -52,7 +52,7 @@ fn test_map_or() {
}
fn get_map_el(key string) ?int {
- m := map{
+ m := {
'as': 3
'qw': 4
'kl': 5
diff --git a/vlib/v/tests/array_sort_lt_overload_test.v b/vlib/v/tests/array_sort_lt_overload_test.v
index b37f022bfb..517c27cf16 100644
--- a/vlib/v/tests/array_sort_lt_overload_test.v
+++ b/vlib/v/tests/array_sort_lt_overload_test.v
@@ -8,13 +8,13 @@ fn (a Num) < (b Num) bool {
fn test_sort_lt_overloaded_struct_array() {
mut arr := []Num{}
- arr << {
+ arr << Num{
value: 10
}
- arr << {
+ arr << Num{
value: 5
}
- arr << {
+ arr << Num{
value: 7
}
arr.sort()
diff --git a/vlib/v/tests/array_to_string_test.v b/vlib/v/tests/array_to_string_test.v
index d647cb4435..92f68be124 100644
--- a/vlib/v/tests/array_to_string_test.v
+++ b/vlib/v/tests/array_to_string_test.v
@@ -45,11 +45,11 @@ fn test_interpolation_array_to_string() {
fn test_interpolation_array_of_map_to_string() {
mut ams := []map[string]string{}
- ams << map{
+ ams << {
'a': 'b'
'c': 'd'
}
- ams << map{
+ ams << {
'e': 'f'
'g': 'h'
}
diff --git a/vlib/v/tests/blank_ident_test.v b/vlib/v/tests/blank_ident_test.v
index 610799c196..73acaa7df9 100644
--- a/vlib/v/tests/blank_ident_test.v
+++ b/vlib/v/tests/blank_ident_test.v
@@ -115,7 +115,7 @@ fn test_nested_for_in_array_both() {
}
const (
- m = map{
+ m = {
'key': 'value'
}
)
diff --git a/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v b/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v
index e515d22092..32f401f066 100644
--- a/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v
+++ b/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v
@@ -1,7 +1,7 @@
import json
fn test_calling_functions_with_map_initializations_containing_arrays() {
- result := json.encode(map{
+ result := json.encode({
// NB: []string{} should NOT be treated as []json.string{}
'users': []string{}
'groups': []string{}
diff --git a/vlib/v/tests/cross_assign_test.v b/vlib/v/tests/cross_assign_test.v
index 43014a14c7..61d4d59986 100644
--- a/vlib/v/tests/cross_assign_test.v
+++ b/vlib/v/tests/cross_assign_test.v
@@ -26,7 +26,7 @@ fn test_cross_assign_of_array_in_fn() {
// Test cross assign of map values
fn test_cross_assign_of_map() {
- mut a := map{
+ mut a := {
'one': 1
'two': 2
}
@@ -42,7 +42,7 @@ fn foo2(mut a map[string]int) {
}
fn test_cross_assign_of_map_in_fn() {
- mut a := map{
+ mut a := {
'one': 1
'two': 2
}
@@ -94,7 +94,7 @@ fn test_cross_assign_of_struct_in_fn() {
// Test cross assign of mixed types
fn test_cross_assign_of_mixed_types() {
mut a := [0, 1]
- mut m := map{
+ mut m := {
'one': 1
'two': 2
}
@@ -119,7 +119,7 @@ fn foo(mut a []int, mut m map[string]int, mut x Zoo) {
fn test_cross_assign_of_mixed_types_in_fn() {
mut a := [0, 1]
- mut m := map{
+ mut m := {
'one': 1
'two': 2
}
@@ -140,7 +140,7 @@ fn test_cross_assign_of_mixed_types_in_fn() {
// Test cross assign of complex types
fn test_cross_assign_of_complex_types() {
mut a := [0, 1]
- mut m := map{
+ mut m := {
'one': 1
'two': 2
}
diff --git a/vlib/v/tests/fn_index_direct_call_test.v b/vlib/v/tests/fn_index_direct_call_test.v
index bef34a404a..45f6e7dc3b 100644
--- a/vlib/v/tests/fn_index_direct_call_test.v
+++ b/vlib/v/tests/fn_index_direct_call_test.v
@@ -18,7 +18,7 @@ fn test_fn_array_direct_call() {
}
fn test_fn_map_direct_call() {
- a := map{
+ a := {
'aaa': fn () string {
return 'aaa'
}
diff --git a/vlib/v/tests/fn_mut_args_test.v b/vlib/v/tests/fn_mut_args_test.v
index 638cb3239e..41e0a29546 100644
--- a/vlib/v/tests/fn_mut_args_test.v
+++ b/vlib/v/tests/fn_mut_args_test.v
@@ -12,7 +12,7 @@ fn test_fn_mut_args_of_array() {
}
fn init_map(mut n map[string]int) {
- n = map{
+ n = {
'one': 1
}
}
@@ -21,7 +21,7 @@ fn test_fn_mut_args_of_map() {
mut m := map[string]int{}
init_map(mut m)
println(m)
- assert m == map{
+ assert m == {
'one': 1
}
}
diff --git a/vlib/v/tests/for_in_containers_of_fixed_array_test.v b/vlib/v/tests/for_in_containers_of_fixed_array_test.v
index 2971140a55..fd020f6fe4 100644
--- a/vlib/v/tests/for_in_containers_of_fixed_array_test.v
+++ b/vlib/v/tests/for_in_containers_of_fixed_array_test.v
@@ -64,7 +64,7 @@ fn test_for_in_fixed_array_of_fixed_array_literal() {
fn test_for_in_map_of_fixed_array() {
mut rets := []string{}
- m := map{
+ m := {
'aa': [1, 2]!
'bb': [3, 4]!
'cc': [5, 6]!
@@ -82,7 +82,7 @@ fn test_for_in_map_of_fixed_array() {
fn test_for_in_map_of_fixed_array_literal() {
mut rets := []string{}
- for k, v in map{
+ for k, v in {
'aa': [1, 2]!
'bb': [3, 4]!
'cc': [5, 6]!
@@ -97,7 +97,7 @@ fn test_for_in_map_of_fixed_array_literal() {
fn test_for_mut_in_map_of_fixed_array() {
mut rets := []string{}
- mut m := map{
+ mut m := {
'aa': [1, 2]!
'bb': [3, 4]!
'cc': [5, 6]!
diff --git a/vlib/v/tests/for_in_mut_val_test.v b/vlib/v/tests/for_in_mut_val_test.v
index d5dfd8e65e..cf4fbdc1a6 100644
--- a/vlib/v/tests/for_in_mut_val_test.v
+++ b/vlib/v/tests/for_in_mut_val_test.v
@@ -31,7 +31,7 @@ fn foo3(mut m map[string][3]int) {
}
fn test_fn_mut_val_of_map() {
- mut m := map{
+ mut m := {
'hello': [1, 2, 3]!
}
foo3(mut m)
@@ -46,7 +46,7 @@ fn foo4(mut m map[string][3]int) {
}
fn test_for_in_mut_val_of_map() {
- mut m := map{
+ mut m := {
'hello': [1, 2, 3]!
}
foo4(mut m)
@@ -55,7 +55,7 @@ fn test_for_in_mut_val_of_map() {
}
fn test_for_in_mut_val_of_map_direct() {
- mut m := map{
+ mut m := {
'foo': 1
'bar': 2
}
@@ -67,16 +67,16 @@ fn test_for_in_mut_val_of_map_direct() {
}
fn test_for_in_mut_val_of_map_fixed_array() {
- mut m := map{
- 'foo': [map{
+ mut m := {
+ 'foo': [{
'a': 1
}]!
- 'bar': [map{
+ 'bar': [{
'b': 2
}]!
}
for _, mut j in m {
- j = [map{
+ j = [{
'c': 3
}]!
}
diff --git a/vlib/v/tests/for_label_continue_break_test.v b/vlib/v/tests/for_label_continue_break_test.v
index f7f01f2cd3..60eeef077c 100644
--- a/vlib/v/tests/for_label_continue_break_test.v
+++ b/vlib/v/tests/for_label_continue_break_test.v
@@ -62,7 +62,7 @@ fn test_for_in_fixed_array_label_continue_break() {
fn test_for_in_map_label_continue_break() {
mut rets := []string{}
- m := map{
+ m := {
'a': 4
'b': 5
'c': 6
diff --git a/vlib/v/tests/for_loops_test.v b/vlib/v/tests/for_loops_test.v
index b09bd2819a..0f347a28f1 100644
--- a/vlib/v/tests/for_loops_test.v
+++ b/vlib/v/tests/for_loops_test.v
@@ -44,7 +44,7 @@ fn test_for_char_in_string() {
}
fn test_for_string_in_map() {
- m := map{
+ m := {
'a': 'b'
'c': 'd'
}
@@ -54,7 +54,7 @@ fn test_for_string_in_map() {
}
assert acc == 'a: b, c: d, '
- mut m2 := map{
+ mut m2 := {
'a': 3
'b': 4
'c': 5
diff --git a/vlib/v/tests/generic_fn_infer_map_test.v b/vlib/v/tests/generic_fn_infer_map_test.v
index 33e63b524d..21927d7c27 100644
--- a/vlib/v/tests/generic_fn_infer_map_test.v
+++ b/vlib/v/tests/generic_fn_infer_map_test.v
@@ -4,32 +4,32 @@ fn print_map(x map[K]V) string {
}
fn test_generics_infer_map_type() {
- m1 := map{
+ m1 := {
'one': 1
}
assert print_map(m1) == "{'one': 1}"
- m2 := map{
+ m2 := {
'one': 1.1
}
assert print_map(m2) == "{'one': 1.1}"
- m3 := map{
+ m3 := {
'one': 'a'
}
assert print_map(m3) == "{'one': 'a'}"
- m4 := map{
+ m4 := {
1: 'one'
}
assert print_map(m4) == "{1: 'one'}"
- m5 := map{
+ m5 := {
1.1: 'one'
}
assert print_map(m5) == "{1.1: 'one'}"
- m6 := map{
+ m6 := {
'a': 'one'
}
assert print_map(m6) == "{'a': 'one'}"
diff --git a/vlib/v/tests/generic_fn_infer_multi_paras_test.v b/vlib/v/tests/generic_fn_infer_multi_paras_test.v
index 71928342ff..6b4562b140 100644
--- a/vlib/v/tests/generic_fn_infer_multi_paras_test.v
+++ b/vlib/v/tests/generic_fn_infer_multi_paras_test.v
@@ -41,7 +41,7 @@ fn test_generic_fn_infer_multi_paras() {
page: 'one'
var_one: 'variable one'
var_two: 'variable two'
- var_three: {
+ var_three: Two_data{
title: 'what a title'
content: 'what a content'
}
diff --git a/vlib/v/tests/generics_return_generics_struct_test.v b/vlib/v/tests/generics_return_generics_struct_test.v
index a48ae4da44..18f9f853d7 100644
--- a/vlib/v/tests/generics_return_generics_struct_test.v
+++ b/vlib/v/tests/generics_return_generics_struct_test.v
@@ -6,7 +6,7 @@ mut:
}
pub fn new_some(value T) Optional {
- return {
+ return Optional{
value: value
some: true
}
@@ -40,7 +40,7 @@ pub struct Foo {
}
pub fn (f Foo) new_some(value T) Optional {
- return {
+ return Optional{
value: value
some: true
}
diff --git a/vlib/v/tests/generics_return_inconsistent_types_generics_struct_test.v b/vlib/v/tests/generics_return_inconsistent_types_generics_struct_test.v
index 7bbf47b7ce..ce742ae3d4 100644
--- a/vlib/v/tests/generics_return_inconsistent_types_generics_struct_test.v
+++ b/vlib/v/tests/generics_return_inconsistent_types_generics_struct_test.v
@@ -7,7 +7,7 @@ mut:
}
pub fn new_some(value T, b B) Optional {
- return {
+ return Optional{
value: value
some: true
typ: typeof(b).name
@@ -54,7 +54,7 @@ pub struct Foo {
}
pub fn (f Foo) new_some(value T, b B) Optional {
- return {
+ return Optional{
value: value
some: true
typ: typeof(b).name
diff --git a/vlib/v/tests/generics_return_multiple_generics_struct_test.v b/vlib/v/tests/generics_return_multiple_generics_struct_test.v
index 3485288616..f8e876039b 100644
--- a/vlib/v/tests/generics_return_multiple_generics_struct_test.v
+++ b/vlib/v/tests/generics_return_multiple_generics_struct_test.v
@@ -5,7 +5,7 @@ mut:
}
fn new_foo(a A, b B) Foo {
- return {
+ return Foo{
a: a
b: b
}
diff --git a/vlib/v/tests/generics_test.v b/vlib/v/tests/generics_test.v
index 714d4ea540..7467d56fb4 100644
--- a/vlib/v/tests/generics_test.v
+++ b/vlib/v/tests/generics_test.v
@@ -11,7 +11,7 @@ fn test_identity() {
assert simple('g') + 'h' == 'gh'
assert simple<[]int>([1])[0] == 1
- assert simple