Repository navigation
Description
Revision (git rev-parse HEAD)
8fb92385a54f3934959c1ff059cb13f2ffe2e78d (origin/main, 2026-10-14 19:51 UTC).
Summary
Two cooperating gaps turn an ordinary-looking Hybrid snippet into a program that hyb check accepts with OK (0 diagnostics) and hyb build --emit-go then emits as invalid Go (the emitted file does not compile - "accepted ? emits a compiling program" is broken):
- Parser (newline-insensitive send fusion): an expression statement followed by a line that starts with a receive expression is parsed as ONE send statement.
noop()/ newline /<-donebecomesnoop() <- done. Go avoids this with automatic semicolon insertion; the Hybrid parser appears to treat<-as a continuation of the previous expression regardless of the line break. - Checker (send target never classified): even a deliberate one-line
noop() <- 1- a send whose channel expression is a void call - is accepted with 0 diagnostics. Nothing validates that the LHS of a send statement resolves to achanshape (a known non-channel should be a type error; an unresolvable one is at least O4.9 fail-closedHYB-E3005).
Either gap alone yields accepted-invalid-emission; fixing (2) also rejects the accidental fusion from (1), so it is the safety net.
Minimal repro A - accidental fusion (the footgun)
// probe-fuse.hy (main @ 8fb9238)
fn noop() {
}
fn main() {
done := make(chan bool, 1)
noop()
<-done
}hyb check probe-fuse.hy ? OK (0 diagnostics).
hyb build probe-fuse.hy --emit-go emits:
func main() {
done := make(chan bool, 1)
noop() <- done
}go build on the emitted file: ./main.go:8:2: noop() (no value) used as value.
Real-world shape: any helper call followed by a <-done drain on the next line (the single most common wait idiom in the corpus/examples) fuses if the helper takes no channel-shaped continuation on the same line.
Minimal repro B - deliberate send-to-non-channel (checker gap)
// probe4.hy (main @ 8fb9238)
fn noop() {
}
fn main() {
noop() <- 1
}hyb check probe4.hy ? OK (0 diagnostics); emission is noop() <- 1 - again invalid Go. The send's target is statically a void call (known non-channel) - this must not be OK under any reading: A1c never gets a chance to run because the site is not even well-typed.
Expected
- Repro A: parse as two statements (
noop(); receive-expr statement), check accepts the plain program (the drain is legal), emission keeps them separate - same asnoop()/ch <- 1already does today (see control below). - Repro B: reject with a type/boundary error (a non-
chansend target -HYB-E3005fail-closed at minimum if the shape is unresolvable; a concrete "cannot send to " diagnostic when it resolves to a call/primitive).
Actual
OK (0 diagnostics)
for both; emitted Go does not compile in both cases.
Severity
Not a data race - no concurrency hazard is reachable through these two programs (the emission fails to build instead). Claimed as a correctness/claim bug: an accepted program must at minimum emit buildable Go. Happy for the maintainer to re-derive (P1 "ownership violation without a race" does not apply either; closest bucket is the accepted-should-have-been-rejected family).
Anything else
- Control that already works:
noop()followed bych <- 1(send statement starting with the channel ident) emits correctly as two statements - the fusion is specific to a following line beginning with the<-receive form. - Another fusion variant seen incidentally while reducing a separate repro:
outer(h, done)/ newline /<-doneemitted asouter(h, done) <- done(same root). - Possible fix directions (not prescriptive): newline/
;-sensitivity in the statement parser when an expression statement is followed by<-(Go ASI-style), and/or statement-level send classification (Expr::Send. whatever the AST spells it - the emit path already has a send form) that resolves the LHS shape and errors on non-chan. - Caught while reducing [soundness] Moving a may-share peer of a parameter escapes the O5.1 non-owned check (h2 := h; task worker(move h2) - OK accepted, fatal error: concurrent map writes) #75's repro - the
r := <-donespelling was needed to dodge this fusion, which is how the two were noticed together. - AI-assisted report (MiMo agent via opencode); reporter of record: @milkingndb-oss.
Activity
rickymulya commentedon Oct 14, 2026
Opened fix PR #78 addressing both gaps:
hy-syntax: line boundary check prevents multi-line expressions and receive statements from fusing across lines (parse_simple_stmt, LX9).hy-check: send channel target proof fails closed (HYB-E3005) when the target expression does not resolve toTypeShape::Chan(_)(§8.4, O4.9).Includes regression tests in
hy-syntaxandhy-checkcovering the two-line repro and fail-closed diagnostics.Batch U (issue #77): newline-sensitive send fusion + send-target clas…
Merge Batch U: newline-sensitive fusion + send-target classification …
fix(hy-syntax): reserve case/default in KEYWORDS - default arms parse…
check: type-check receive operands (HYB-E2008/E3005) — the receive-si…
Merge pr-420 (Leimiu-G, fixes #409): type-check receive operands (HYB…
fix(check): type-check for-in iterables (HYB-E2009/E3005) and resolve…
fix(hy-syntax): a line-leading `(` starts a statement, not an argumen…
fix(checker): time.after deadline channels accepted a send — emitted …
fix(checker): time.after deadline channels accepted a send — emitted …
fix(checker): time.after deadline channels accepted a send — emitted …
fix(checker): time.after deadline channels accepted a send — emitted …
fix(checker): time.after deadline channels accepted a send — emitted …
fix(checker): time.after deadline channels accepted a send — emitted …
fix(checker): time.after deadline channels accepted a send — emitted …