Commit 6aead18ab3

Veikka Tuominen <git@vexu.eu>
2022-08-28 12:17:25
add error tests for now correctly behaving cases
Closes #6377
1 parent 1401890
test/cases/compile_errors/duplicate_field_in_discarded_anon_init.zig
@@ -0,0 +1,10 @@
+pub export fn entry() void {
+    _ = .{ .a = 0, .a = 1 };
+}
+
+// error
+// backend=stage2
+// target=native
+//
+// :2:21: error: duplicate field
+// :2:13: note: other field here
test/cases/compile_errors/struct_init_passed_to_type_param.zig
@@ -0,0 +1,14 @@
+const MyStruct = struct { x: i32 };
+
+fn hi(comptime T: type) usize {
+    return @sizeOf(T);
+}
+
+export const value = hi(MyStruct{ .x = 12 });
+
+// error
+// backend=stage2
+// target=native
+//
+// :7:33: error: expected type 'type', found 'tmp.MyStruct'
+// :1:18: note: struct declared here