File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -12666,7 +12666,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira
12666
12666
static TypeTableEntry *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira,
12667
12667
IrInstructionCheckStatementIsVoid *instruction)
12668
12668
{
12669
- IrInstruction *statement_value = instruction->statement_value;
12669
+ IrInstruction *statement_value = instruction->statement_value->other ;
12670
12670
TypeTableEntry *statement_type = statement_value->value.type;
12671
12671
if (type_is_invalid(statement_type))
12672
12672
return ira->codegen->builtin_types.entry_invalid;
Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ fn getString(st: &ElfStackTrace, offset: u64) -> %[]u8 {
217
217
fn readAllocBytes (in_stream : & io.InStream , size : usize ) - > % []u8 {
218
218
const buf = % return global_allocator .alloc (u8 , size );
219
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
221
return buf ;
222
222
}
223
223
Original file line number Diff line number Diff line change @@ -1348,6 +1348,37 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
1348
1348
\\fn bar() -> i32 { 0 }
1349
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
1382
cases .add ("integer literal on a non-comptime var" ,
1352
1383
\\export fn foo() {
1353
1384
\\ var i = 0;
You can’t perform that action at this time.
0 commit comments