mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
692a718428
commit
a97ed55a09
@ -511,6 +511,9 @@ pub fn (mut c Checker) struct_init(mut struct_init ast.StructInit) table.Type {
|
||||
struct_init.pos)
|
||||
}
|
||||
}
|
||||
if type_sym.name.len == 1 && !c.cur_fn.is_generic {
|
||||
c.error('unknown struct `$type_sym.name`', struct_init.pos)
|
||||
}
|
||||
match type_sym.kind {
|
||||
.placeholder {
|
||||
c.error('unknown struct: $type_sym.name', struct_init.pos)
|
||||
|
6
vlib/v/checker/tests/unknown_struct_name.out
Normal file
6
vlib/v/checker/tests/unknown_struct_name.out
Normal file
@ -0,0 +1,6 @@
|
||||
vlib/v/checker/tests/unknown_struct_name.vv:4:7: error: unknown struct `F`
|
||||
2 |
|
||||
3 | fn main() {
|
||||
4 | _ := F{}
|
||||
| ~~~
|
||||
5 | }
|
5
vlib/v/checker/tests/unknown_struct_name.vv
Normal file
5
vlib/v/checker/tests/unknown_struct_name.vv
Normal file
@ -0,0 +1,5 @@
|
||||
module main
|
||||
|
||||
fn main() {
|
||||
_ := F{}
|
||||
}
|
Loading…
Reference in New Issue
Block a user