V version: V 0.1.23 4dc4f12
OS: Windows 10
What did you do?
struct Test<T, U> {
a T
b U
}
pub fn (t Test) str() string {
return t.a.str() + " : " + t.b.str()
}
fn main() {}
What did you expect to see?
nothing.
What did you see instead?
test.v:7:11: type `Test` has no field or method `a`
5|
6| pub fn (t Test) str() string {
7| return t.a.str() + " : " + t.b.str()
^
8| }
9|
Affects every fn (generic struct) name().
fn(generic struct\
under playground:
syntax error: unexpected <, expecting {
1| struct Test
pub fn (t Test) str() string {
return t.a.str() + " : " + t.b.str()
}
As the docs say, it should be pub fn (t Test<T, U>).
struct Test<T, U> {
t T
u U
}
pub fn (a Test<T, U>) str() string {
return "Test"
}
fn main() {}
test.v:5:21: unknown receiver type `Test_T`
The error is now (V 0.1.27 c9f3a05):
test2.v:1:8: error: Test lacks body
1 | struct Test
| ~~~~
2 | t T
3 | u U
Most helpful comment
test.v:5:21: unknown receiver type `Test_T`