diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-11-21 15:12:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-21 15:12:03 -0500 |
| commit | 54d196bb300770394fd57db718ff1768edd552f8 (patch) | |
| tree | bea1eab99aeed800b92fc589ad505cb84a86f122 /test/behavior | |
| parent | be6f76655fb355426dc8f3824368376608bc0ba1 (diff) | |
| parent | d63298da65df7fa2712bf9e9d65d36cd91af22fa (diff) | |
| download | zig-54d196bb300770394fd57db718ff1768edd552f8.tar.gz zig-54d196bb300770394fd57db718ff1768edd552f8.zip | |
Merge pull request #18057 from Vexu/fixes
Fix bad error location on field init with field access
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/call.zig | 21 |
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); +} |
