Repository navigation
fix(hy-check): keyword-name checks on enums, dotted associated fns, import aliases (fixes #4190) - #4278
Open
kotomuch wants to merge 2 commits into
Open
fix(hy-check): keyword-name checks on enums, dotted associated fns, import aliases (fixes #4190)#4278kotomuch wants to merge 2 commits into
kotomuch wants to merge 2 commits into
Conversation
kotomuch
force-pushed
the
fix-4190-keyword-names
branch
2 times, most recently
from
November 9, 2026 20:27
11f7267 to
d5e8eb1
Compare
kotomuch
force-pushed
the
fix-4190-keyword-names
branch
from
November 9, 2026 23:25
d5e8eb1 to
74fc63f
Compare
… errors (fixes limitlessprojects#4171) - errors.new/unwrap: exactly 1 argument - errors.is/as: exactly 2 arguments - errors.join: at least 1 argument - errors.err_unsupported: variable, not callable (HYB-E1002) - errors.wrap keeps dedicated operand validation (limitlessprojects#3572), unchanged - new regression tests in errors_call_buildable_soundness.rs
…mport aliases (fixes limitlessprojects#4190) Three declaration surfaces bypassed HYB-E1002 (default/none): - Decl::Enum was skipped entirely: enum names, variant names, and payload types now go through kw_name/kw_type. - Decl::Fn dotted names (box.default, default.build) compared the whole string against the keyword; each dot-segment is checked now. - Decl::Import unhandled: non-rust imports register the trailing path segment as the Go package identifier, so it is keyword-checked; rust/ crates keep their separate registration rule. Doc comment updated (enum variants are no longer left alone). New tests: go_keyword_enum_dotted_import_names.rs (7 tests, harness of go_keyword_default_names.rs).
kotomuch
force-pushed
the
fix-4190-keyword-names
branch
from
November 10, 2026 00:28
74fc63f to
d5cf9ee
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.
Summary
Extends the
go_keyword_namespass (HYB-E1002, Row 13 BUILDABLE) to three declaration surfaces that previously bypassed thedefault/nonedetector (fixes #4190).Root Cause & Defect
compiler/crates/hy-check/src/go_keyword_names.rsenforced keyword-name hygiene on locals, params, receivers, structs, aliases, consts, fields, loop vars, select/match bindings — but missed:Decl::Enumskipped entirely (matched to{}alongsideImport):enum default { … }, variant names (enum state { default }), and payload types carryingdefault/nonepassed check with 0 diagnostics, then failedhyb build(hy-emit spells enum names/variants verbatim).self.kw_name(&f.name, …)compared the full dotted string ("box.default","default.build") against the keyword — never equal, so associated fns nameddefault/nonein either segment bypassed the check.Decl::Importunhandled: non-Rust imports register the trailing path segment as the Go package identifier (lib.rsrsplit; emissionroot.Member()inhy-emit), soimport "x/default"produced unparseable Go.Changes
Decl::Enum: enum name ("enum"), each variant name ("enum variant"), payload types viakw_type.Decl::Fn: splitf.nameon.and check each segment (dotted receiver-associated names).Decl::Import: for!path.starts_with("rust/")check the trailing segment ("package import");rust/crates keep their separate registration rule (prefix-rooted, not trailing-segment).Tests
New
compiler/crates/hy-check/tests/go_keyword_enum_dotted_import_names.rs(harness mirrorsgo_keyword_default_names.rs):nonevariants, payload traversal (fn param + struct field through enum payload), dottedbox.default/box.none/default.build, import aliases (x/default,y/none, baredefault);box.defaults), rust/ import, clean alias (x/fallback), plainfmt.Test names listed rather than runner counts: no local cargo on this machine; fork CI and your battery are the verification loop — happy to fix anything they flag.
Cost honesty
What breaks: programs declaring enums/dotted-fns/imports named
defaultornone— previously accepted, then failinggo build(Row 13 violations, exactly the class this pass closes). Existing valid programs unaffected (positive controls pinrust/imports and clean names).Disclosure: Authored by an autonomous coding agent; the account owner has reviewed the patch and stands behind every line.