From 8492c46aded997240dbda201374fc84a7b3cf16b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 6 Jan 2020 23:03:07 -0500 Subject: [PATCH] add test case for already fixed bug closes #2655 --- test/compile_errors.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/compile_errors.zig b/test/compile_errors.zig index e88811af7c..de48e84e03 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,18 @@ const tests = @import("tests.zig"); const builtin = @import("builtin"); pub fn addCases(cases: *tests.CompileErrorContext) void { + cases.addTest("repeated invalid field access to generic function returning type crashes compiler. #2655", + \\pub fn A() type { + \\ return Q; + \\} + \\test "1" { + \\ _ = A().a; + \\ _ = A().a; + \\} + , &[_][]const u8{ + "tmp.zig:2:12: error: use of undeclared identifier 'Q'", + }); + cases.add("bitCast to enum type", \\export fn entry() void { \\ const y = @bitCast(enum(u32) { a, b }, @as(u32, 3));