| author | |
| committer | |
| log | ac7971122dc32f59d82430285e7eaefe5d0d4301 |
| tree | 191b797a0b54b9832711dc76e88d98d460546291 |
| parent | c6605cba8375871a145896f9cf1090e9c823214a |
see #2913 files changed, 33 insertions(+), 2 deletions(-)
src/ir.cpp+1-1| ... | @@ -12666,7 +12666,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira | ... | @@ -12666,7 +12666,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira |
| 12666 | static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira, | 12666 | static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira, |
| 12667 | IrInstructionCheckStatementIsVoid *instruction) | 12667 | IrInstructionCheckStatementIsVoid *instruction) |
| 12668 | { | 12668 | { |
| 12669 | IrInstruction *statement_value = instruction->statement_value; | 12669 | IrInstruction *statement_value = instruction->statement_value->other; |
| 12670 | TypeTableEntry *statement_type = statement_value->value.type; | 12670 | TypeTableEntry *statement_type = statement_value->value.type; |
| 12671 | if (type_is_invalid(statement_type)) | 12671 | if (type_is_invalid(statement_type)) |
| 12672 | return ira->codegen->builtin_types.entry_invalid; | 12672 | return ira->codegen->builtin_types.entry_invalid; |
std/debug.zig+1-1| ... | @@ -217,7 +217,7 @@ fn getString(st: &ElfStackTrace, offset: u64) -> %[]u8 { | ... | @@ -217,7 +217,7 @@ fn getString(st: &ElfStackTrace, offset: u64) -> %[]u8 { |
| 217 | fn readAllocBytes(in_stream: &io.InStream, size: usize) -> %[]u8 { | 217 | fn readAllocBytes(in_stream: &io.InStream, size: usize) -> %[]u8 { |
| 218 | const buf = %return global_allocator.alloc(u8, size); | 218 | const buf = %return global_allocator.alloc(u8, size); |
| 219 | %defer global_allocator.free(buf); | 219 | %defer global_allocator.free(buf); |
| 220 | if (size < %return in_stream.read(buf)) return error.Eof; | 220 | if ((%return in_stream.read(buf)) < size) return error.Eof; |
| 221 | return buf; | 221 | return buf; |
| 222 | } | 222 | } |
| 223 | 223 |
test/compile_errors.zig+31| ... | @@ -1348,6 +1348,37 @@ pub fn addCases(cases: &tests.CompileErrorContext) { | ... | @@ -1348,6 +1348,37 @@ pub fn addCases(cases: &tests.CompileErrorContext) { |
| 1348 | \\fn bar() -> i32 { 0 } | 1348 | \\fn bar() -> i32 { 0 } |
| 1349 | , ".tmp_source.zig:2:8: error: expression value is ignored"); | 1349 | , ".tmp_source.zig:2:8: error: expression value is ignored"); |
| 1350 | 1350 | ||
| 1351 | cases.add("ignored assert-err-ok return value", | ||
| 1352 | \\export fn foo() { | ||
| 1353 | \\ %%bar(); | ||
| 1354 | \\} | ||
| 1355 | \\fn bar() -> %i32 { 0 } | ||
| 1356 | , ".tmp_source.zig:2:5: error: expression value is ignored"); | ||
| 1357 | |||
| 1358 | cases.add("ignored statement value", | ||
| 1359 | \\export fn foo() { | ||
| 1360 | \\ 1; | ||
| 1361 | \\} | ||
| 1362 | , ".tmp_source.zig:2:5: error: expression value is ignored"); | ||
| 1363 | |||
| 1364 | cases.add("ignored comptime statement value", | ||
| 1365 | \\export fn foo() { | ||
| 1366 | \\ comptime {1;} | ||
| 1367 | \\} | ||
| 1368 | , ".tmp_source.zig:2:15: error: expression value is ignored"); | ||
| 1369 | |||
| 1370 | cases.add("ignored comptime value", | ||
| 1371 | \\export fn foo() { | ||
| 1372 | \\ comptime 1; | ||
| 1373 | \\} | ||
| 1374 | , ".tmp_source.zig:2:5: error: expression value is ignored"); | ||
| 1375 | |||
| 1376 | cases.add("ignored defered statement value", | ||
| 1377 | \\export fn foo() { | ||
| 1378 | \\ defer {1;} | ||
| 1379 | \\} | ||
| 1380 | , ".tmp_source.zig:2:12: error: expression value is ignored"); | ||
| 1381 | |||
| 1351 | cases.add("integer literal on a non-comptime var", | 1382 | cases.add("integer literal on a non-comptime var", |
| 1352 | \\export fn foo() { | 1383 | \\export fn foo() { |
| 1353 | \\ var i = 0; | 1384 | \\ var i = 0; |