Skip to content

Commit ce799f5

Browse files
authored
Assert unreachable cases in getBasicHeapTypeLUB (#7735)
This currently seems to be a bit inconsistent with the null types that already use assertions / unreachable for cases that are already handled above: ```c++ // Bottom types already handled. WASM_UNREACHABLE("unexpected basic type"); ``` It isn't a very meaningful change, I'd just like to verify that I don't misunderstand the implementation. 🫣
1 parent 6f4e4f7 commit ce799f5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/wasm/wasm-type.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,13 @@ std::optional<HeapType> getBasicHeapTypeLUB(HeapType::BasicHeapType a,
407407
HeapType lubUnshared;
408408
switch (HeapType(a).getBasic(Unshared)) {
409409
case HeapType::ext:
410-
if (bUnshared != HeapType::string) {
411-
return std::nullopt;
412-
}
410+
assert(bUnshared == HeapType::string);
413411
lubUnshared = HeapType::ext;
414412
break;
415413
case HeapType::func:
416414
case HeapType::cont:
417415
case HeapType::exn:
418-
return std::nullopt;
416+
WASM_UNREACHABLE("Unexpected non-bottom type in same hierarchy");
419417
case HeapType::any:
420418
lubUnshared = HeapType::any;
421419
break;

0 commit comments

Comments
 (0)