Repository navigation
Conversation
`fn step() error` has ONE Go result. The fn-shape collector counted the trailing error as a value too, so `step()?` desugared to `hyT0, hyErr1 := step()` and the emitted Go failed go build with an assignment mismatch. The value count now excludes the trailing error slot.
Upstream added test_emit_t9_set_surface in the same integration test file; kept it alongside the new bare-error regression test.
airdropia
force-pushed
the
fix/try-bare-error
branch
from
October 18, 2026 23:33
98d852e to
65e69e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
fn step() error+step()?passeshyb check, then the emitted Go failsgo build:Why it happened
The fn-shape collector (
hy-emit/src/lib.rs) recorded(f.results.len(), err, ...)— a trailingerrorresult counted as a value AND as the error slot.fn step() errorhas exactly one Go result, so the?hoister's(1, true)reading produced
hyT0, hyErr1 := step(), which Go rejects.run()?inmainhit the same shape.The fix
The value count now excludes the trailing error slot:
The hoister's
(0, true)special case (already present instmt.rs—hyErrN := callwith no value temp) now applies to bare-error user functionsthe same way it already applied to rust-crate methods like
serde_json.value.set(...).Files:
compiler/crates/hy-emit/src/lib.rs(one line + comment).Tests
New emitter test
bare_error_fn_under_try_emits_zero_value_tempspins theemitted shape:
hyErr0 := step()and nohyT0, hyErr1 := step().No local Go toolchain: CI (parse + emit tests + go build of examples) is the
oracle.