Skip to content

fix(hy-check): reject untyped nil as append slice argument - #4952

Open
BP202302 wants to merge 1 commit into
limitlessprojects:mainfrom
BP202302:codex/microbounties-bad6732f6e9aa80ae40c43ca
Open

BP202302 wants to merge 1 commit into
limitlessprojects:mainfrom
BP202302:codex/microbounties-bad6732f6e9aa80ae40c43ca

Conversation

@BP202302

Copy link
Copy Markdown

append(nil, 1) is still accepted without diagnostics on main 76becf1ccb5d440a183bbba1e07fa1ea4b3da91d, although Go rejects it because its first argument has no slice type. The nil-element cases from this issue are already covered by the #3518 guard on main.

Reject an untyped nil first argument with HYB-E2005, including parenthesized literals, an empty append tail, and a variadic tail. Keep typed zero-valued slices, nilable elements, and a user-defined function named append accepted. Add regression coverage and the required language/decision notes.

Validation on Rust/Cargo 1.99.0 and Go 1.26.9, Linux ARM64:

  • The new regression fails before the fix: append(nil, 1) returns Accept with zero diagnostics. Both new tests pass after the fix; the existing [soundness] hy-check: builtin delete and append accept untyped nil for non-nilable key and element types (Row 13 BUILDABLE) #3518 suite passes 4/4.
  • All 3,295 workspace tests pass, with zero ignored: lib/bin/doc tests and all 500 integration targets. Integration targets were executed individually to bound disk usage.
  • Checker corpus: 139/139. Differential: 47/47 accepted programs build and run; 92/92 rejected programs match their rules.
  • Go independently rejects all five invalid forms and builds four typed-slice controls.
  • Test registration, corpus census, evidence links, guarantees, conflict-marker guards and git diff --check pass.

The differential run uses a temporary directory inside the checkout: the sandbox exposes an empty /tmp/.git that otherwise breaks Go's VCS stamping. Tests and compiler behavior are unchanged by this environment adjustment. Hosted GitHub Actions and maintainer review are pending.

Issue: #2745

Closes #2745

AI assistance: implementation, regression coverage and local validation were prepared with Codex; no human validation is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[soundness] Builtin append accepts untyped nil as first argument and in non-nilable element positions (Row 13 BUILDABLE violation)

1 participant