Repository navigation
Description
Revision
c53978bd33734169fa5299f5ac3eaf4c3c325fb9 (origin/main, 2026-10-17). hyb built from this tree (rustc 1.85.1), emitted Go built with the pinned go1.26.9.
Summary
Outside the ownership rules, the checker never asks whether an operand has a type its operator accepts. Every program below is a plain fn main() { ... } that hyb check accepts with OK (0 diagnostics). hyb build --emit-go emits it, and go build fails with the quoted error. There are five families, and none overlaps an open issue (see "Not duplicates").
| # | body of fn main() |
go build error on the emitted Go |
|---|---|---|
| A. Non-boolean conditions | ||
| A1 | x := 5 / if x { fmt.println(1) } |
non-boolean condition in if statement |
| A2 | x := 5 / for x { x = 0 } |
non-boolean condition in for statement |
| B. Operator / operand type mismatch | ||
| B1 | x := 5 / fmt.println(!x) |
operator ! not defined on x (variable of type int) |
| B2 | s := "a" / fmt.println(-s) |
operator - not defined on s (variable of type string) |
| B3 | x := 5 / s := "a" / fmt.println(x + s) |
invalid operation: x + s (mismatched types int and string) |
| B4 | x := 5 / fmt.println(x && true) |
invalid operation: x && true (mismatched types int and untyped bool) |
| B5 | b := true / fmt.println(b < false) |
operator < not defined on bool |
| B6 | s := "a" / s++ / fmt.println(s) |
invalid operation: s++ (non-numeric type string) |
| C. Index / slice of a non-indexable value | ||
| C1 | x := 5 / fmt.println(x[0]) |
cannot index x (variable of type int) |
| C2 | x := 5 / fmt.println(x[0:1]) |
cannot slice x (variable of type int) |
| D. Calling a non-function | ||
| D1 | x := 5 / fmt.println(x()) |
cannot call x (variable of type int): int is not a function |
| E. Builtin operand kind via a binding (#187 deliberately covered literals only) | ||
| E1 | x := 5 / fmt.println(len(x)) |
invalid argument: x (variable of type int) for built-in len |
| E2 | x := 5 / close(x) |
cannot close non-channel x (variable of type int) |
| E3 | m := map[string]int{} / fmt.println(cap(m)) |
invalid argument: m (variable of type map[string]int) for built-in cap |
| E4 | xs := []int{1} / delete(xs, 0) / fmt.println(xs) |
invalid argument: xs (variable of type []int) is not a map |
| E5 | x := 5 / x = append(x, 1) / fmt.println(x) |
invalid append: argument must be a slice; have x (variable of type int) |
(/ separates lines. Each repro is its own file, e.g. fn main() {\n x := 5\n if x { fmt.println(1) }\n}.)
Repro loop: hyb check f.hy → f.hy: OK (0 diagnostics); hyb build f.hy -o out/bin --emit-go; cd out && go mod init p && go build . → the error above.
Expected
Each shape gets a Hybrid diagnostic with a span. For the builtins (E) that is an extension of #187's BUILTIN-ARGS rule from literals to resolved binding shapes. A–D need a new BUILDABLE code or codes. In every case shape_of_expr already resolves the operand (Primitive / Str / Map / Slice ...), which is the same data #77 (send target), #409 (receive operand) and #411 (range iterable) classify. The fix is one operand-kind check per operator site, and Unknown stays on the existing fail-closed path.
Controls that must keep passing: if ok {} with a bool, !b, -n, a + b on two ints or two strings, xs[i], s[0:1], m[k], f() on a fn binding, len(s), len(m), cap(xs), close(ch), delete(m, k), append(xs, v).
Not duplicates
- [soundness] builtin arguments never validated (make size, len/cap/delete/close) and defer accepts non-calls (E2001 registered but never raised) - accepted programs emit Go that fails go vet/build #187 (closed): builtin misuse with literal operands only (
len(5),close(5)). Its own text scopes out non-literals. E1–E5 use bindings and are still accepted on main. - expressions are never checked against declared shapes: call arity, return arity, struct fields, and map key types are all accepted then unbuildable #152: call/return arity, struct-field existence, and map-key/struct-literal element types. None of A–E.
- [soundness] four accepted-but-unbuildable families on c09e992: undefined names (E1001 registered but never raised), six unreserved Go keywords, constant-conversion misuse, i64-overflowing literals #228: undefined names, Go keywords, constant conversions, i64 literals. [soundness] receive operand is never type-checked —
<-xon a non-channel (int / map / call result) is accepted with 0 diagnostics and emits non-compiling Go (asymmetric with send-side HYB-E3007) #409 covers the receive operand, [soundness]for x in enever type-checks the iterable — ranging over an int / bool / struct / non-iterable call result is accepted with 0 diagnostics and emits non-compiling Go (cannot range over) #411 the range operand, and [soundness]?is never checked against its operand — on option/int/closure-local calls accepted with 0 diagnostics and emits non-compiling Go (E4/T20 unimplemented) #155 the?operand. - Searched issues/PRs for
non-boolean,cannot index,cannot slice,operator,mismatched types,cannot call,non-numeric,is not a mapandinvalid append. Nothing open covers these.
Claimed severity
Medium, in the accepted-but-unbuildable family (same track as #187/#152/#409/#411). These are the most ordinary beginner mistakes, and each surfaces as raw Go compiler output instead of a Hybrid diagnostic.
Activity
gelismarvel commentedon Oct 17, 2026
/claim #425
Fixes #425
Submitting verified fix PR for #425.
hardik4love-lang commentedon Oct 17, 2026
/claim #425
Fixes #425
Submitting verified comprehensive fix PR #430 (submitted at 11:38:06Z, #1 in queue):
Implementation Highlights in #430:
fix(check): type-check operand types for conditions, index, slice, ca…
ci(fork): shared limitlessprojects#425 fixture battery across main an…
Suifeng-2077 commentedon Oct 17, 2026
Measured the two open takes against this issue's own reproduction set, on real builds.
I built
hybfrom main and from each PR head with the repo pins (Go 1.26.9, rust 1.99.0), then ran all 16 shapes from the table above plus 4 positive controls (if ok {}on a bool,-non an int,xs[0],len(m)).ACCEPTmeanshyb checkreturns 0 diagnostics, which is the bug this issue describes.Corpus regression on the same binaries: #430
52/52, #43152/52, tripwire not fired on either, so neither take trades coverage for new over-rejection.So #431 closes all five families (A-E) and keeps the controls intact; #430 closes C, D and E, and part of B, but leaves non-boolean
if/forand the!/++operator mismatches accepted even though its title covers conditions. The two touch disjoint files (emit_guard.rs+ a new test module vsbuildable.rs), so this is a coverage difference rather than a duplicate - but #431 alone satisfies the issue as written.Scope: this compares behaviour only. I did not review either patch for correctness beyond what the battery and the corpus show, and the diagnostic codes differ between the two (
HYB-E2009/HYB-E2005in #430,HYB-E1002/HYB-E2005in #431), which is a policy choice for the maintainer, not mine.fix: resolve operand types are never checked: non-boolean if/for cond…
fix(check): type-check operand types for conditions, index, slice, ca…
fix(check): type-check operand types for conditions, index, slice, ca…
hardik4love-lang commentedon Oct 17, 2026
@Suifeng-2077 @limitlessprojects
Thank you for the benchmarking data! As the #1 queue submitter (submitted at 11:38:06Z), I have updated PR #430 in commit
c10f33a(cleanly rebased onto current upstreammain@07d63ec):buildable.rs, closing all 5 families (A1, A2, B1–B6, C1–C2, D1, E1–E5) underHYB-E1002(A–D) andHYB-E2005(E).if ok {},-n,xs[0],len(m), etc.) continue to accept with 0 diagnostics.BUILDABLE(HYB-E1002) andBUILTIN-ARGS(HYB-E2005), completely avoiding collision with upcoming receive PR check: type-check receive operands (HYB-E2008/E3005) — the receive-side mirror of #77's send-target rule (fixes #409) #420 (HYB-E2008) and range PR fix(hy-check): reject non-iterablefor x in eoperands (HYB-E2009, fixes #411) #424 (HYB-E2009).compiler/crates/hy-check/src/buildable.rs,MERGEABLEstatus confirmed.fix(check): type-check operand types for conditions, index, slice, ca…
fix(check): type-check operand types for conditions, index, slice, ca…
fix(check): type-check operand types for conditions, index, slice, ca…
Merge pr-430 (hardik4love-lang, fixes limitlessprojects#425; twin PR l…
Merge pr-430 (hardik4love-lang, fixes limitlessprojects#425; twin PR l…
honru09 commentedon Oct 18, 2026
Hi, I'm the reporter of this issue. Saw it got closed via #430 — nice work on the fix.
Just wanted to check: as the first reporter of #425, does the issue bounty still count for me? Want to make sure I understand how the reporting reward works when someone else's PR lands the fix.
Merge pr-536 (o2splatform-cmyk, fixes #533): shadow-aware buildable g…