Skip to content

Commit ea74b4f

Browse files
authored
[NFC] Add a comment in MergeBlocks about subtyping (#4142)
Followup to #4137
1 parent 96f7acf commit ea74b4f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/passes/MergeBlocks.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,14 @@ struct MergeBlocks
467467
// fancy here
468468
return outer;
469469
}
470-
// we are going to replace the block with the final element, so they
471-
// should be identically typed
470+
// We are going to replace the block with the final element, so they
471+
// should be identically typed. Note that we could check for subtyping
472+
// here, but it would not help in the general case: we know that this
473+
// block has no breaks (as confirmed above), and so the local-subtyping
474+
// pass will turn its type into that of its final element, if the final
475+
// element has a more specialized type. (If we did want to handle that,
476+
// we'd need to then run a ReFinalize after everything, which would add
477+
// more complexity here.)
472478
if (block->type != back->type) {
473479
return outer;
474480
}

0 commit comments

Comments
 (0)