authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-10-28 12:15:21-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-10-28 12:15:37-04:00
loge4271f4fb26ce7245f73bcf9ffd33d1bd47a02e6
tree86bbcf83cf8308dbe89f85684c4fee545b11663b
parente3857a361c528d23d1a9f727619c379bea1a3563

more test coverage, change 'got' to 'found' in errors


2 files changed, 54 insertions(+), 49 deletions(-)

src/analyze.cpp+33-33
......@@ -887,7 +887,7 @@ static TypeTableEntry *resolve_type(CodeGen *g, AstNode *node) {
887887 } else if (expr->type_entry->id == TypeTableEntryIdMetaType) {
888888 // OK
889889 } else {
890 add_node_error(g, node, buf_sprintf("expected type, found expression"));
890 add_node_error(g, node, buf_sprintf("expected type 'type', found '%s'", buf_ptr(&expr->type_entry->name)));
891891 return g->builtin_types.entry_invalid;
892892 }
893893
......@@ -1139,7 +1139,7 @@ static FnTableEntry *resolve_const_expr_fn(CodeGen *g, ImportTableEntry *import,
11391139
11401140 return const_val->data.x_fn;
11411141 } else {
1142 add_node_error(g, *node, buf_sprintf("expected function, got '%s'", buf_ptr(&resolved_type->name)));
1142 add_node_error(g, *node, buf_sprintf("expected function, found '%s'", buf_ptr(&resolved_type->name)));
11431143 return nullptr;
11441144 }
11451145}
......@@ -2292,7 +2292,7 @@ static TypeTableEntry *resolve_type_compatibility(CodeGen *g, ImportTableEntry *
22922292
22932293 if (!reported_err) {
22942294 add_node_error(g, first_executing_node(node),
2295 buf_sprintf("expected type '%s', got '%s'",
2295 buf_sprintf("expected type '%s', found '%s'",
22962296 buf_ptr(&expected_type->name),
22972297 buf_ptr(&actual_type->name)));
22982298 }
......@@ -3564,14 +3564,14 @@ static TypeTableEntry *analyze_array_mult(CodeGen *g, ImportTableEntry *import,
35643564
35653565 if (op1_type->id != TypeTableEntryIdArray) {
35663566 add_node_error(g, *op1,
3567 buf_sprintf("expected array type, got '%s'", buf_ptr(&op1_type->name)));
3567 buf_sprintf("expected array type, found '%s'", buf_ptr(&op1_type->name)));
35683568 return g->builtin_types.entry_invalid;
35693569 }
35703570
35713571 if (op2_type->id != TypeTableEntryIdNumLitInt &&
35723572 op2_type->id != TypeTableEntryIdInt)
35733573 {
3574 add_node_error(g, *op2, buf_sprintf("expected integer type, got '%s'", buf_ptr(&op2_type->name)));
3574 add_node_error(g, *op2, buf_sprintf("expected integer type, found '%s'", buf_ptr(&op2_type->name)));
35753575 return g->builtin_types.entry_invalid;
35763576 }
35773577
......@@ -3750,7 +3750,7 @@ static TypeTableEntry *analyze_bin_op_expr(CodeGen *g, ImportTableEntry *import,
37503750 return child_type;
37513751 } else {
37523752 add_node_error(g, op1,
3753 buf_sprintf("expected maybe type, got '%s'",
3753 buf_sprintf("expected maybe type, found '%s'",
37543754 buf_ptr(&lhs_type->name)));
37553755 return g->builtin_types.entry_invalid;
37563756 }
......@@ -3770,7 +3770,7 @@ static TypeTableEntry *analyze_bin_op_expr(CodeGen *g, ImportTableEntry *import,
37703770 op1_type->data.pointer.child_type == g->builtin_types.entry_u8) {
37713771 child_type = op1_type->data.pointer.child_type;
37723772 } else {
3773 add_node_error(g, *op1, buf_sprintf("expected array or C string literal, got '%s'",
3773 add_node_error(g, *op1, buf_sprintf("expected array or C string literal, found '%s'",
37743774 buf_ptr(&op1_type->name)));
37753775 return g->builtin_types.entry_invalid;
37763776 }
......@@ -3781,7 +3781,7 @@ static TypeTableEntry *analyze_bin_op_expr(CodeGen *g, ImportTableEntry *import,
37813781 return g->builtin_types.entry_invalid;
37823782 } else if (op2_type->id == TypeTableEntryIdArray) {
37833783 if (op2_type->data.array.child_type != child_type) {
3784 add_node_error(g, *op2, buf_sprintf("expected array of type '%s', got '%s'",
3784 add_node_error(g, *op2, buf_sprintf("expected array of type '%s', found '%s'",
37853785 buf_ptr(&child_type->name),
37863786 buf_ptr(&op2_type->name)));
37873787 return g->builtin_types.entry_invalid;
......@@ -3789,7 +3789,7 @@ static TypeTableEntry *analyze_bin_op_expr(CodeGen *g, ImportTableEntry *import,
37893789 } else if (op2_type->id == TypeTableEntryIdPointer &&
37903790 op2_type->data.pointer.child_type == g->builtin_types.entry_u8) {
37913791 } else {
3792 add_node_error(g, *op2, buf_sprintf("expected array or C string literal, got '%s'",
3792 add_node_error(g, *op2, buf_sprintf("expected array or C string literal, found '%s'",
37933793 buf_ptr(&op2_type->name)));
37943794 return g->builtin_types.entry_invalid;
37953795 }
......@@ -3829,12 +3829,12 @@ static TypeTableEntry *analyze_bin_op_expr(CodeGen *g, ImportTableEntry *import,
38293829 } else if (op1_type->id == TypeTableEntryIdPointer) {
38303830 if (!op1_val->data.x_ptr.is_c_str) {
38313831 add_node_error(g, *op1,
3832 buf_sprintf("expected array or C string literal, got '%s'",
3832 buf_sprintf("expected array or C string literal, found '%s'",
38333833 buf_ptr(&op1_type->name)));
38343834 return g->builtin_types.entry_invalid;
38353835 } else if (!op2_val->data.x_ptr.is_c_str) {
38363836 add_node_error(g, *op2,
3837 buf_sprintf("expected array or C string literal, got '%s'",
3837 buf_sprintf("expected array or C string literal, found '%s'",
38383838 buf_ptr(&op2_type->name)));
38393839 return g->builtin_types.entry_invalid;
38403840 }
......@@ -3951,7 +3951,7 @@ static TypeTableEntry *analyze_unwrap_error_expr(CodeGen *g, ImportTableEntry *i
39513951 return child_type;
39523952 } else {
39533953 add_node_error(g, op1,
3954 buf_sprintf("expected error type, got '%s'", buf_ptr(&lhs_type->name)));
3954 buf_sprintf("expected error type, found '%s'", buf_ptr(&lhs_type->name)));
39553955 return g->builtin_types.entry_invalid;
39563956 }
39573957}
......@@ -4976,7 +4976,7 @@ static TypeTableEntry *analyze_cmpxchg(CodeGen *g, ImportTableEntry *import,
49764976 return g->builtin_types.entry_invalid;
49774977 } else if (ptr_type->id != TypeTableEntryIdPointer) {
49784978 add_node_error(g, *ptr_arg,
4979 buf_sprintf("expected pointer argument, got '%s'", buf_ptr(&ptr_type->name)));
4979 buf_sprintf("expected pointer argument, found '%s'", buf_ptr(&ptr_type->name)));
49804980 return g->builtin_types.entry_invalid;
49814981 }
49824982
......@@ -5082,7 +5082,7 @@ static TypeTableEntry *analyze_div_exact(CodeGen *g, ImportTableEntry *import,
50825082 zig_panic("TODO");
50835083 } else {
50845084 add_node_error(g, node,
5085 buf_sprintf("expected integer type, got '%s'", buf_ptr(&result_type->name)));
5085 buf_sprintf("expected integer type, found '%s'", buf_ptr(&result_type->name)));
50865086 return g->builtin_types.entry_invalid;
50875087 }
50885088}
......@@ -5102,16 +5102,16 @@ static TypeTableEntry *analyze_truncate(CodeGen *g, ImportTableEntry *import,
51025102 return g->builtin_types.entry_invalid;
51035103 } else if (dest_type->id != TypeTableEntryIdInt) {
51045104 add_node_error(g, *op1,
5105 buf_sprintf("expected integer type, got '%s'", buf_ptr(&dest_type->name)));
5105 buf_sprintf("expected integer type, found '%s'", buf_ptr(&dest_type->name)));
51065106 return g->builtin_types.entry_invalid;
51075107 } else if (src_type->id != TypeTableEntryIdInt) {
51085108 add_node_error(g, *op2,
5109 buf_sprintf("expected integer type, got '%s'", buf_ptr(&src_type->name)));
5109 buf_sprintf("expected integer type, found '%s'", buf_ptr(&src_type->name)));
51105110 return g->builtin_types.entry_invalid;
51115111 } else if (src_type->data.integral.is_signed != dest_type->data.integral.is_signed) {
51125112 const char *sign_str = dest_type->data.integral.is_signed ? "signed" : "unsigned";
51135113 add_node_error(g, *op2,
5114 buf_sprintf("expected %s integer type, got '%s'", sign_str, buf_ptr(&src_type->name)));
5114 buf_sprintf("expected %s integer type, found '%s'", sign_str, buf_ptr(&src_type->name)));
51155115 return g->builtin_types.entry_invalid;
51165116 } else if (src_type->data.integral.bit_count <= dest_type->data.integral.bit_count) {
51175117 add_node_error(g, *op2,
......@@ -5348,12 +5348,12 @@ static TypeTableEntry *analyze_set_debug_safety(CodeGen *g, ImportTableEntry *im
53485348 target_context = type_arg->data.unionation.block_context;
53495349 } else {
53505350 add_node_error(g, *target_node,
5351 buf_sprintf("expected scope reference, got type '%s'", buf_ptr(&type_arg->name)));
5351 buf_sprintf("expected scope reference, found type '%s'", buf_ptr(&type_arg->name)));
53525352 return g->builtin_types.entry_invalid;
53535353 }
53545354 } else {
53555355 add_node_error(g, *target_node,
5356 buf_sprintf("expected scope reference, got type '%s'", buf_ptr(&target_type->name)));
5356 buf_sprintf("expected scope reference, found type '%s'", buf_ptr(&target_type->name)));
53575357 return g->builtin_types.entry_invalid;
53585358 }
53595359
......@@ -5398,7 +5398,7 @@ static TypeTableEntry *analyze_builtin_fn_call_expr(CodeGen *g, ImportTableEntry
53985398
53995399 if (builtin_fn->param_count != actual_param_count) {
54005400 add_node_error(g, node,
5401 buf_sprintf("expected %zu arguments, got %zu",
5401 buf_sprintf("expected %zu arguments, found %zu",
54025402 builtin_fn->param_count, actual_param_count));
54035403 return g->builtin_types.entry_invalid;
54045404 }
......@@ -5428,7 +5428,7 @@ static TypeTableEntry *analyze_builtin_fn_call_expr(CodeGen *g, ImportTableEntry
54285428 result_node);
54295429 } else {
54305430 add_node_error(g, type_node,
5431 buf_sprintf("expected integer type, got '%s'", buf_ptr(&int_type->name)));
5431 buf_sprintf("expected integer type, found '%s'", buf_ptr(&int_type->name)));
54325432 }
54335433
54345434 // TODO constant expression evaluation
......@@ -5448,14 +5448,14 @@ static TypeTableEntry *analyze_builtin_fn_call_expr(CodeGen *g, ImportTableEntry
54485448 dest_type->id != TypeTableEntryIdPointer)
54495449 {
54505450 add_node_error(g, dest_node,
5451 buf_sprintf("expected pointer argument, got '%s'", buf_ptr(&dest_type->name)));
5451 buf_sprintf("expected pointer argument, found '%s'", buf_ptr(&dest_type->name)));
54525452 }
54535453
54545454 if (src_type->id != TypeTableEntryIdInvalid &&
54555455 src_type->id != TypeTableEntryIdPointer)
54565456 {
54575457 add_node_error(g, src_node,
5458 buf_sprintf("expected pointer argument, got '%s'", buf_ptr(&src_type->name)));
5458 buf_sprintf("expected pointer argument, found '%s'", buf_ptr(&src_type->name)));
54595459 }
54605460
54615461 if (dest_type->id == TypeTableEntryIdPointer &&
......@@ -5486,7 +5486,7 @@ static TypeTableEntry *analyze_builtin_fn_call_expr(CodeGen *g, ImportTableEntry
54865486 dest_type->id != TypeTableEntryIdPointer)
54875487 {
54885488 add_node_error(g, dest_node,
5489 buf_sprintf("expected pointer argument, got '%s'", buf_ptr(&dest_type->name)));
5489 buf_sprintf("expected pointer argument, found '%s'", buf_ptr(&dest_type->name)));
54905490 }
54915491
54925492 return builtin_fn->return_type;
......@@ -5703,7 +5703,7 @@ static TypeTableEntry *analyze_builtin_fn_call_expr(CodeGen *g, ImportTableEntry
57035703 return resolved_type;
57045704 } else {
57055705 add_node_error(g, type_node,
5706 buf_sprintf("expected integer type, got '%s'", buf_ptr(&int_type->name)));
5706 buf_sprintf("expected integer type, found '%s'", buf_ptr(&int_type->name)));
57075707 return g->builtin_types.entry_invalid;
57085708 }
57095709 }
......@@ -5794,12 +5794,12 @@ static TypeTableEntry *analyze_fn_call_ptr(CodeGen *g, ImportTableEntry *import,
57945794 if (call_param_count < expect_arg_count) {
57955795 ok_invocation = false;
57965796 add_node_error(g, node,
5797 buf_sprintf("expected at least %zu arguments, got %zu", src_param_count, call_param_count));
5797 buf_sprintf("expected at least %zu arguments, found %zu", src_param_count, call_param_count));
57985798 }
57995799 } else if (expect_arg_count != call_param_count) {
58005800 ok_invocation = false;
58015801 add_node_error(g, node,
5802 buf_sprintf("expected %zu arguments, got %zu", expect_arg_count, call_param_count));
5802 buf_sprintf("expected %zu arguments, found %zu", expect_arg_count, call_param_count));
58035803 }
58045804
58055805 bool all_args_const_expr = true;
......@@ -5914,7 +5914,7 @@ static TypeTableEntry *analyze_fn_call_with_inline_args(CodeGen *g, ImportTableE
59145914
59155915 if (src_param_count != call_param_count + struct_node_1_or_0) {
59165916 add_node_error(g, call_node,
5917 buf_sprintf("expected %zu arguments, got %zu", src_param_count - struct_node_1_or_0, call_param_count));
5917 buf_sprintf("expected %zu arguments, found %zu", src_param_count - struct_node_1_or_0, call_param_count));
59185918 return g->builtin_types.entry_invalid;
59195919 }
59205920
......@@ -6042,7 +6042,7 @@ static TypeTableEntry *analyze_generic_fn_call(CodeGen *g, ImportTableEntry *imp
60426042
60436043 if (actual_param_count != expected_param_count) {
60446044 add_node_error(g, first_executing_node(node),
6045 buf_sprintf("expected %zu arguments, got %zu", expected_param_count, actual_param_count));
6045 buf_sprintf("expected %zu arguments, found %zu", expected_param_count, actual_param_count));
60466046 return g->builtin_types.entry_invalid;
60476047 }
60486048
......@@ -6379,7 +6379,7 @@ static TypeTableEntry *analyze_prefix_op_expr(CodeGen *g, ImportTableEntry *impo
63796379 return type_entry->data.error.child_type;
63806380 } else {
63816381 add_node_error(g, *expr_node,
6382 buf_sprintf("expected error type, got '%s'", buf_ptr(&type_entry->name)));
6382 buf_sprintf("expected error type, found '%s'", buf_ptr(&type_entry->name)));
63836383 return g->builtin_types.entry_invalid;
63846384 }
63856385 }
......@@ -6393,7 +6393,7 @@ static TypeTableEntry *analyze_prefix_op_expr(CodeGen *g, ImportTableEntry *impo
63936393 return type_entry->data.maybe.child_type;
63946394 } else {
63956395 add_node_error(g, *expr_node,
6396 buf_sprintf("expected maybe type, got '%s'", buf_ptr(&type_entry->name)));
6396 buf_sprintf("expected maybe type, found '%s'", buf_ptr(&type_entry->name)));
63976397 return g->builtin_types.entry_invalid;
63986398 }
63996399 }
......@@ -6689,7 +6689,7 @@ static TypeTableEntry *analyze_return_expr(CodeGen *g, ImportTableEntry *import,
66896689 return resolved_type->data.error.child_type;
66906690 } else {
66916691 add_node_error(g, node->data.return_expr.expr,
6692 buf_sprintf("expected error type, got '%s'", buf_ptr(&resolved_type->name)));
6692 buf_sprintf("expected error type, found '%s'", buf_ptr(&resolved_type->name)));
66936693 return g->builtin_types.entry_invalid;
66946694 }
66956695 }
......@@ -6717,7 +6717,7 @@ static TypeTableEntry *analyze_return_expr(CodeGen *g, ImportTableEntry *import,
67176717 return resolved_type->data.maybe.child_type;
67186718 } else {
67196719 add_node_error(g, node->data.return_expr.expr,
6720 buf_sprintf("expected maybe type, got '%s'", buf_ptr(&resolved_type->name)));
6720 buf_sprintf("expected maybe type, found '%s'", buf_ptr(&resolved_type->name)));
67216721 return g->builtin_types.entry_invalid;
67226722 }
67236723 }
test/run_tests.cpp+21-16
......@@ -689,11 +689,11 @@ fn a() {}
689689
690690 add_compile_fail_case("unreachable with return", R"SOURCE(
691691fn a() -> unreachable {return;}
692 )SOURCE", 1, ".tmp_source.zig:2:24: error: expected type 'unreachable', got 'void'");
692 )SOURCE", 1, ".tmp_source.zig:2:24: error: expected type 'unreachable', found 'void'");
693693
694694 add_compile_fail_case("control reaches end of non-void function", R"SOURCE(
695695fn a() -> i32 {}
696 )SOURCE", 1, ".tmp_source.zig:2:15: error: expected type 'i32', got 'void'");
696 )SOURCE", 1, ".tmp_source.zig:2:15: error: expected type 'i32', found 'void'");
697697
698698 add_compile_fail_case("undefined function call", R"SOURCE(
699699fn a() {
......@@ -706,7 +706,7 @@ fn a() {
706706 b(1);
707707}
708708fn b(a: i32, b: i32, c: i32) { }
709 )SOURCE", 1, ".tmp_source.zig:3:6: error: expected 3 arguments, got 1");
709 )SOURCE", 1, ".tmp_source.zig:3:6: error: expected 3 arguments, found 1");
710710
711711 add_compile_fail_case("invalid type", R"SOURCE(
712712fn a() -> bogus {}
......@@ -761,7 +761,7 @@ fn f() -> i32 {
761761 const a = c"a";
762762 a
763763}
764 )SOURCE", 1, ".tmp_source.zig:4:5: error: expected type 'i32', got '&const u8'");
764 )SOURCE", 1, ".tmp_source.zig:4:5: error: expected type 'i32', found '&const u8'");
765765
766766 add_compile_fail_case("if condition is bool, not int", R"SOURCE(
767767fn f() {
......@@ -819,7 +819,7 @@ fn f() {
819819 )SOURCE", 4, ".tmp_source.zig:4:5: error: use of undeclared identifier 'i'",
820820 ".tmp_source.zig:4:7: error: use of undeclared identifier 'i'",
821821 ".tmp_source.zig:5:8: error: array access of non-array",
822 ".tmp_source.zig:5:9: error: expected type 'usize', got 'bool'");
822 ".tmp_source.zig:5:9: error: expected type 'usize', found 'bool'");
823823
824824 add_compile_fail_case("variadic functions only allowed in extern", R"SOURCE(
825825fn f(...) {}
......@@ -838,7 +838,7 @@ fn f(b: bool) {
838838 const x : i32 = if (b) { 1 };
839839 const y = if (b) { i32(1) };
840840}
841 )SOURCE", 2, ".tmp_source.zig:3:21: error: expected type 'i32', got 'void'",
841 )SOURCE", 2, ".tmp_source.zig:3:21: error: expected type 'i32', found 'void'",
842842 ".tmp_source.zig:4:15: error: incompatible types: 'i32' and 'void'");
843843
844844 add_compile_fail_case("direct struct loop", R"SOURCE(
......@@ -1014,7 +1014,7 @@ const x = foo();
10141014fn f(s: []u8) -> []u8 {
10151015 s ++ "foo"
10161016}
1017 )SOURCE", 1, ".tmp_source.zig:3:5: error: expected array or C string literal, got '[]u8'");
1017 )SOURCE", 1, ".tmp_source.zig:3:5: error: expected array or C string literal, found '[]u8'");
10181018
10191019 add_compile_fail_case("non compile time array concatenation", R"SOURCE(
10201020fn f(s: [10]u8) -> []u8 {
......@@ -1069,7 +1069,7 @@ const members = []member_fn_type {
10691069fn f(foo: Foo, index: i32) {
10701070 const result = members[index]();
10711071}
1072 )SOURCE", 1, ".tmp_source.zig:21:34: error: expected 1 arguments, got 0");
1072 )SOURCE", 1, ".tmp_source.zig:21:34: error: expected 1 arguments, found 0");
10731073
10741074 add_compile_fail_case("missing function name and param name", R"SOURCE(
10751075fn () {}
......@@ -1084,22 +1084,22 @@ fn a() -> i32 {0}
10841084fn b() -> i32 {1}
10851085fn c() -> i32 {2}
10861086 )SOURCE", 3,
1087 ".tmp_source.zig:2:21: error: expected type 'fn()', got 'fn() -> i32'",
1088 ".tmp_source.zig:2:24: error: expected type 'fn()', got 'fn() -> i32'",
1089 ".tmp_source.zig:2:27: error: expected type 'fn()', got 'fn() -> i32'");
1087 ".tmp_source.zig:2:21: error: expected type 'fn()', found 'fn() -> i32'",
1088 ".tmp_source.zig:2:24: error: expected type 'fn()', found 'fn() -> i32'",
1089 ".tmp_source.zig:2:27: error: expected type 'fn()', found 'fn() -> i32'");
10901090
10911091 add_compile_fail_case("extern function pointer mismatch", R"SOURCE(
10921092const fns = [](fn(i32)->i32){ a, b, c };
10931093pub fn a(x: i32) -> i32 {x + 0}
10941094pub fn b(x: i32) -> i32 {x + 1}
10951095export fn c(x: i32) -> i32 {x + 2}
1096 )SOURCE", 1, ".tmp_source.zig:2:37: error: expected type 'fn(i32) -> i32', got 'extern fn(i32) -> i32'");
1096 )SOURCE", 1, ".tmp_source.zig:2:37: error: expected type 'fn(i32) -> i32', found 'extern fn(i32) -> i32'");
10971097
10981098
10991099 add_compile_fail_case("implicit cast from f64 to f32", R"SOURCE(
11001100const x : f64 = 1.0;
11011101const y : f32 = x;
1102 )SOURCE", 1, ".tmp_source.zig:3:17: error: expected type 'f32', got 'f64'");
1102 )SOURCE", 1, ".tmp_source.zig:3:17: error: expected type 'f32', found 'f64'");
11031103
11041104
11051105 add_compile_fail_case("colliding invalid top level functions", R"SOURCE(
......@@ -1221,7 +1221,7 @@ fn derp(){}
12211221
12221222 add_compile_fail_case("assign null to non-nullable pointer", R"SOURCE(
12231223const a: &u8 = null;
1224 )SOURCE", 1, ".tmp_source.zig:2:16: error: expected type '&u8', got '(null)'");
1224 )SOURCE", 1, ".tmp_source.zig:2:16: error: expected type '&u8', found '(null)'");
12251225
12261226 add_compile_fail_case("indexing an array of size zero", R"SOURCE(
12271227const array = []u8{};
......@@ -1383,7 +1383,7 @@ fn f() {
13831383 const x: u32 = 10;
13841384 @truncate(i8, x);
13851385}
1386 )SOURCE", 1, ".tmp_source.zig:4:19: error: expected signed integer type, got 'u32'");
1386 )SOURCE", 1, ".tmp_source.zig:4:19: error: expected signed integer type, found 'u32'");
13871387
13881388 add_compile_fail_case("truncate same bit count", R"SOURCE(
13891389fn f() {
......@@ -1493,7 +1493,7 @@ fn f(foo: &const Foo) {
14931493
14941494 foo.method(1, 2);
14951495}
1496 )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 1 arguments, got 2");
1496 )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 1 arguments, found 2");
14971497
14981498 add_compile_fail_case("assign through constant pointer", R"SOURCE(
14991499fn f() {
......@@ -1623,6 +1623,11 @@ fn privateFunction() { }
16231623 )SOURCE");
16241624 }
16251625
1626 add_compile_fail_case("container init with non-type", R"SOURCE(
1627const zero: i32 = 0;
1628const a = zero{1};
1629 )SOURCE", 1, ".tmp_source.zig:3:11: error: expected type 'type', found 'i32'");
1630
16261631}
16271632
16281633//////////////////////////////////////////////////////////////////////////////