issues: file 0060 — closure-literal composition miscompiles (blocks ERR/E5.1)

Probing ERR/E5.1 (composition with closures) surfaced pre-existing closure-
literal lowering bugs: a closure literal passed as a function-type argument and
called inside the callee returns wrong values (block-body 192, arrow-body 20,
want 10 — non-failable too; the working contrast passes the value as a separate
arg, examples/0302). On top of that, failable closure returns don't parse
(isLambda omits .bang — one-line fix in the issue) and arrow-body failable
closures miscompile (return 0); block-body failable closures called directly
work. Runnable repro + parser patch + investigation prompt in the issue.

E5.1 paused per the impassable rule rather than built on miscompiling closures;
the parser fix + a regression example were reverted to avoid landing silently-
miscompiling failable closures on master.
This commit is contained in:
agra
2026-06-01 20:18:25 +03:00
parent 549f97c731
commit 485b4fa618
4 changed files with 112 additions and 4 deletions

View File

@@ -3304,7 +3304,8 @@ pub const Parser = struct {
self.current.tag == .l_bracket or self.current.tag == .r_bracket or
self.current.tag == .l_paren or self.current.tag == .r_paren or
self.current.tag == .comma or self.current.tag == .int_literal or
self.current.tag == .star or self.current.tag == .question)
self.current.tag == .star or self.current.tag == .question or
self.current.tag == .bang)
{
self.advance();
} else break;