diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-07 11:34:04 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-07 11:34:24 -0700 |
| commit | ee22e872967947d2f6e64cba888bf7bf56e4d332 (patch) | |
| tree | 02935f88bf83494ea3a4da056206e64ed9f2cfc3 /test | |
| parent | 1d4c66b56beb7b2da6bafbab6871691641c8da0b (diff) | |
| download | zig-ee22e872967947d2f6e64cba888bf7bf56e4d332.tar.gz zig-ee22e872967947d2f6e64cba888bf7bf56e4d332.zip | |
generic functions use correct type for generic args
See #22
Diffstat (limited to 'test')
| -rw-r--r-- | test/self_hosted.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/self_hosted.zig b/test/self_hosted.zig index 3b1473c57a..f715fffe2c 100644 --- a/test/self_hosted.zig +++ b/test/self_hosted.zig @@ -516,12 +516,17 @@ three)"; fn simple_generic_fn() { assert(max(i32)(3, -1) == 3); assert(max(f32)(0.123, 0.456) == 0.456); + assert(add(2)(3) == 5); } fn max(T: type)(a: T, b: T) -> T { return if (a > b) a else b; } +fn add(a: i32)(b: i32) -> i32 { + return a + b; +} + #attribute("test") fn constant_equal_function_pointers() { |
