We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
field map
1 parent ca55da6 commit 03e89b7Copy full SHA for 03e89b7
vlib/v/checker/tests/map_def_err.out
@@ -0,0 +1,5 @@
1
+vlib/v/checker/tests/map_def_err.vv:2:7: error: cannot use the map type without key and value definition
2
+ 1 | struct Foo {
3
+ 2 | bar map
4
+ | ~~~
5
+ 3 | }
vlib/v/checker/tests/map_def_err.vv
@@ -0,0 +1,3 @@
+struct Foo {
+ bar map
+}
vlib/v/parser/parse_type.v
@@ -116,6 +116,11 @@ fn (mut p Parser) parse_map_type() ast.Type {
116
}
117
p.next()
118
if p.tok.kind != .lsbr {
119
+ if p.inside_struct_field_decl {
120
+ p.error_with_pos('cannot use the map type without key and value definition',
121
+ p.prev_tok.pos())
122
+ return 0
123
+ }
124
return ast.map_type
125
126
p.check(.lsbr)
0 commit comments