vxx2 / vlib / v / checker / tests / generics_struct_declaration_err.vv
24 lines · 19 sloc · 314 bytes · ef5be22f81005b2237311a79b6383138084b0c53
Raw
1struct GenericChannelStruct[T] {
2 ch chan T
3}
4
5struct MyGenericChannelStruct {
6 GenericChannelStruct[T]
7 msg string
8}
9
10struct Simple {
11 msg string
12}
13
14fn main() {
15 new_channel_struct[Simple]()
16}
17
18pub fn new_channel_struct[T]() GenericChannelStruct[T] {
19 d := GenericChannelStruct[T]{
20 ch: chan T{}
21 }
22
23 return d
24}
25