Commit 7a968cd5
7a968cd5a840Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Revert "codegen: box a concrete scalar in a poly-returning implicit-return tail"
This reverts commit 86c914b8c44160ec617beac1aa51b011a28fb6aa.
Details
- Commit
- 7a968cd5a840
- Parent
- 67c068808b20
src/codegen_stmt.cmodifiedView file
@@ -1870,15 +1870,7 @@
18701870
any other emission (e.g. a poly-dispatch `({...})`) is passed through18711871
unchanged. */18721872
static void emit_tail_value(Compiler *c, int node, Buf *b) {1873-
if (g_ret_type == TY_POLY) {1874-
/* a poly-returning tail must yield an sp_RbVal: box a concrete scalar value1875-
(e.g. an implicit `return 1` from a method widened under promote). The1876-
explicit-return caller already boxes, so this only adds coverage for the1877-
implicit-return path; a node that is already poly boxes to itself. */1878-
if (comp_ntype(c, node) != TY_POLY) emit_boxed(c, node, b);1879-
else emit_expr(c, node, b);1880-
return;1881-
}1873+
if (g_ret_type == TY_POLY) { emit_expr(c, node, b); return; }18821874
/* An empty `{}` literal defaults to StrPolyHash, but in a hash-returning tail18831875
it must take the return type (e.g. a SymPolyHash-returning method whose18841876
other branch is `{ a: 1 }`); otherwise the StrPolyHash* return is an