aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cases/eval.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/cases/eval.zig b/test/cases/eval.zig
index 027bb643b6..00906488c0 100644
--- a/test/cases/eval.zig
+++ b/test/cases/eval.zig
@@ -263,3 +263,23 @@ fn fnWithSetDebugSafety() -> i32{
@setDebugSafety(this, true);
return 1234;
}
+
+
+
+const SimpleStruct = struct {
+ field: i32,
+
+ fn method(self: &const SimpleStruct) -> i32 {
+ return self.field + 3;
+ }
+};
+
+var simple_struct = SimpleStruct{ .field = 1234, };
+
+const bound_fn = simple_struct.method;
+
+fn callMethodOnBoundFnReferringToVarInstance() {
+ @setFnTest(this);
+
+ assert(bound_fn() == 1237);
+}