aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2023-11-21 13:44:03 +0200
committerVeikka Tuominen <git@vexu.eu>2023-11-21 13:59:14 +0200
commitd63298da65df7fa2712bf9e9d65d36cd91af22fa (patch)
treea6da55d3509c34bc9de0199e2bdf408e5ab27ac6 /test/behavior
parenta947f97331595df4ee340bbcfcef7241555c687b (diff)
downloadzig-d63298da65df7fa2712bf9e9d65d36cd91af22fa.tar.gz
zig-d63298da65df7fa2712bf9e9d65d36cd91af22fa.zip
InternPool: handle `funcZirBodyInst` for `func_coerced`
Closes #18039
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/call.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/behavior/call.zig b/test/behavior/call.zig
index a476ba1788..b579f85213 100644
--- a/test/behavior/call.zig
+++ b/test/behavior/call.zig
@@ -499,3 +499,24 @@ test "call inline fn through pointer" {
const f = &S.foo;
try f(123);
}
+
+test "call coerced function" {
+ const T = struct {
+ x: f64,
+ const T = @This();
+ usingnamespace Implement(1);
+ const F = fn (comptime f64) type;
+ const Implement: F = opaque {
+ fn implementer(comptime val: anytype) type {
+ return opaque {
+ fn incr(self: T) T {
+ return .{ .x = self.x + val };
+ }
+ };
+ }
+ }.implementer;
+ };
+
+ const a = T{ .x = 3 };
+ try std.testing.expect(a.incr().x == 4);
+}