| 1336 | } |
| 1337 | |
| 1338 | fn typecheck_results( |
| 1339 | &self, |
| 1340 | inst: Inst, |
| 1341 | ctrl_type: Type, |
| 1342 | errors: &mut VerifierErrors, |
| 1343 | ) -> VerifierStepResult { |
| 1344 | let mut i = 0; |
| 1345 | for &result in self.func.dfg.inst_results(inst) { |
| 1346 | let result_type = self.func.dfg.value_type(result); |
| 1347 | let expected_type = self.func.dfg.compute_result_type(inst, i, ctrl_type); |
| 1348 | if let Some(expected_type) = expected_type { |
| 1349 | if result_type != expected_type { |
| 1350 | errors.report(( |
| 1351 | inst, |
| 1352 | self.context(inst), |
| 1353 | format!( |
| 1354 | "expected result {i} ({result}) to have type {expected_type}, found {result_type}" |
| 1355 | ), |
| 1356 | )); |
| 1357 | } |
| 1358 | } else { |
| 1359 | return errors.nonfatal(( |
| 1360 | inst, |
| 1361 | self.context(inst), |
| 1362 | "has more result values than expected", |
| 1363 | )); |
| 1364 | } |
| 1365 | i += 1; |
| 1366 | } |
| 1367 | |
| 1368 | // There aren't any more result types left. |
| 1369 | if self.func.dfg.compute_result_type(inst, i, ctrl_type) != None { |
| 1370 | return errors.nonfatal(( |
| 1371 | inst, |
| 1372 | self.context(inst), |
| 1373 | "has fewer result values than expected", |
| 1374 | )); |
| 1375 | } |
| 1376 | Ok(()) |
| 1377 | } |
| 1378 | |
| 1379 | fn typecheck_fixed_args( |
| 1380 | &self, |