Commit 7db39384f7
Changed files (2)
test
behavior
cases
compile_errors
test/behavior/eval.zig
@@ -572,28 +572,6 @@ test "inlined loop has array literal with elided runtime scope on first iteratio
}
}
-test "call method on bound fn referring to var instance" {
- if (builtin.zig_backend != .stage1) {
- // Let's delay solving this one; I want to try to eliminate bound functions from
- // the language.
- return error.SkipZigTest; // TODO
- }
-
- try expect(bound_fn() == 1237);
-}
-
-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;
-
test "ptr to local array argument at comptime" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
test/cases/compile_errors/call method on bound fn referring to var instance.zig
@@ -0,0 +1,20 @@
+export fn entry() void {
+ bad(bound_fn() == 1237);
+}
+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 bad(ok: bool) void {
+ _ = ok;
+}
+// error
+// target=native
+// backend=stage2
+//
+// :12:18: error: unable to resolve comptime value