From 4ea2331e3d900079a502432dbefb06528b62afab Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 16 Aug 2019 10:54:45 -0400 Subject: [PATCH] add test for async call of generic function See #3063 --- test/stage1/behavior/async_fn.zig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/stage1/behavior/async_fn.zig b/test/stage1/behavior/async_fn.zig index 13f7be677..a6231e460 100644 --- a/test/stage1/behavior/async_fn.zig +++ b/test/stage1/behavior/async_fn.zig @@ -740,3 +740,23 @@ test "no reason to resolve frame still works" { fn simpleNothing() void { var x: i32 = 1234; } + +test "async call a generic function" { + const S = struct { + fn doTheTest() void { + var f = async func(i32, 2); + const result = await f; + expect(result == 3); + } + + fn func(comptime T: type, inc: T) T { + var x: T = 1; + suspend { + resume @frame(); + } + x += inc; + return x; + } + }; + _ = async S.doTheTest(); +}