v2 / vlib / v / tests / generics / generics_method_ordering_test.v
27 lines · 21 sloc · 336 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Foo[T] {
2 x int
3}
4
5fn (f Foo[T]) pop() {
6 println('hey')
7}
8
9struct Bar[T] {
10 y int
11}
12
13// Note: Bar.foo before Bar.pop, should not cause a V compiler panic
14fn (b Bar[T]) foo() bool {
15 return true
16}
17
18fn (b Bar[T]) pop() {
19 println(b.foo())
20}
21
22// fn dummy() { println(Bar<int>{}) }
23
24fn test_foo() {
25 dump(Foo[int]{})
26 assert true
27}
28