1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/generics_with_nested_generics_fn_test.v

28 lines
395 B
V

struct NestedGeneric {
}
struct Context {
}
struct App {
mut:
context Context
}
fn (ng NestedGeneric) nested_test[T](mut app T) {
app.context = Context{}
}
fn method_test[T](mut app T) int {
ng := NestedGeneric{}
ng.nested_test[T](mut app)
return 22
}
fn test_generics_with_generics_fn() {
mut app := App{}
ret := method_test(mut app)
println('result = ${ret}')
assert ret == 22
}