| 1 | struct Foo[T] { |
| 2 | a T |
| 3 | } |
| 4 | |
| 5 | fn test_shared_struct_has_generics() { |
| 6 | shared foo := Foo[int]{1} |
| 7 | lock foo { |
| 8 | assert foo.a == 1 |
| 9 | } |
| 10 | shared bar := &Foo[int]{1} |
| 11 | lock bar { |
| 12 | assert bar.a == 1 |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | fn generic_struct_as_parameters(shared arg Foo[int]) { |
| 17 | rlock arg { |
| 18 | assert arg.a == 1 |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | fn test_generic_struct_as_parameters() { |
| 23 | shared foo := Foo[int]{1} |
| 24 | generic_struct_as_parameters(shared foo) |
| 25 | } |
| 26 |