| 1 | fn example[T]() ?T { |
| 2 | return T{} |
| 3 | } |
| 4 | |
| 5 | struct Foo { |
| 6 | a int = 10 |
| 7 | b string |
| 8 | } |
| 9 | |
| 10 | fn test_main() { |
| 11 | dump(example[[1]Foo]()) |
| 12 | |
| 13 | a := example[[1]Foo]() |
| 14 | assert a? == [Foo{}]! |
| 15 | |
| 16 | dump(example2[[1]Foo]()!) |
| 17 | |
| 18 | b := example2[[1]Foo]()! |
| 19 | assert b == [Foo{}]! |
| 20 | } |
| 21 | |
| 22 | fn example2[T]() !T { |
| 23 | return T{} |
| 24 | } |
| 25 |