| 1 | import math |
| 2 | import datatypes |
| 3 | |
| 4 | struct Foo { |
| 5 | a int |
| 6 | } |
| 7 | |
| 8 | struct Bar[T] { |
| 9 | a int |
| 10 | } |
| 11 | |
| 12 | fn (b Bar[T]) pop() {} |
| 13 | |
| 14 | fn test_bar_foo_works_even_when_datatypes_is_imported_that_also_has_pop_methods() { |
| 15 | mut a := Bar[Foo]{} |
| 16 | println(a) |
| 17 | assert true |
| 18 | } |
| 19 | |
| 20 | fn test_datatypes_can_be_used_without_interfering_with_local_generic_structs() { |
| 21 | mut stack := datatypes.Stack[int]{} |
| 22 | stack.push(1) |
| 23 | println(stack) |
| 24 | assert true |
| 25 | } |
| 26 | |
| 27 | fn test_generic_type_inference_on_generic_function_from_another_module_still_works() { |
| 28 | x := -123 |
| 29 | a := math.abs(x) |
| 30 | assert x == -123 |
| 31 | assert a == 123 |
| 32 | } |
| 33 |