v/vlib/v/checker/tests/generics_struct_declaration...

25 lines
314 B
V

struct GenericChannelStruct<T> {
ch chan T
}
struct MyGenericChannelStruct {
GenericChannelStruct<T>
msg string
}
struct Simple {
msg string
}
fn main() {
new_channel_struct<Simple>()
}
pub fn new_channel_struct<T>() GenericChannelStruct<T> {
d := GenericChannelStruct<T>{
ch: chan T{}
}
return d
}