| 1 | struct Foo[T] { |
| 2 | len T |
| 3 | } |
| 4 | |
| 5 | fn t[T](val T) string { |
| 6 | a := val.len + val.len |
| 7 | println(a) |
| 8 | return a.str() |
| 9 | } |
| 10 | |
| 11 | fn test_main() { |
| 12 | assert t(Foo[string]{ len: 'hello' }) == 'hellohello' |
| 13 | assert t(Foo[int]{ len: 123 }) == '246' |
| 14 | assert t([1, 2, 3]) == '6' |
| 15 | assert t([1.2, 2.2, 3.3]) == '6' |
| 16 | assert t(['', '', '']) == '6' |
| 17 | } |
| 18 |