Commit 8492c46ade

Andrew Kelley <andrew@ziglang.org>
2020-01-07 05:03:07
add test case for already fixed bug
closes #2655
1 parent 8c640b3
Changed files (1)
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));