Commit e28c85ea
e28c85eabd52Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified
Description
Merge pull request #1469 from rubys/fix-poly-dispatch-void-arms
Poly dispatch: void-arm guards must cover the full no-value set {VOID,NIL,UNKNOWN}
Details
- Commit
- e28c85eabd52
- Parent
- 77a27c0c0213
- Merge parent
- a56df0b5f9c0
src/codegen_call.cmodifiedView file
@@ -1526,7 +1526,7 @@
15261526
if (kmi < 0) continue;15271527
TyKind kr = (TyKind)c->scopes[kmi].ret;15281528
buf_printf(b, " case %d: ", k);1529-
if (unified == TY_POLY && (kr == TY_UNKNOWN || kr == TY_VOID)) {1529+
if (unified == TY_POLY && (kr == TY_UNKNOWN || kr == TY_VOID || kr == TY_NIL)) {15301530
/* void-return (raises): call then fall through with nil */15311531
emit_method_cname(c, &c->scopes[kmi], b);15321532
buf_puts(b, "(");@@ -1559,7 +1559,7 @@
15591559
buf_printf(b, " default: ");15601560
{15611561
TyKind dr = (TyKind)c->scopes[defmi].ret;1562-
if (unified == TY_POLY && (dr == TY_UNKNOWN || dr == TY_VOID)) {1562+
if (unified == TY_POLY && (dr == TY_UNKNOWN || dr == TY_VOID || dr == TY_NIL)) {15631563
emit_method_cname(c, &c->scopes[defmi], b);15641564
buf_puts(b, "(");15651565
emit_args_filled(c, defmi, nt_ref(nt, id, "arguments"), "", b);src/codegen_fold.cmodifiedView file
Loading diff…