Repository navigation
feat!: parse contextual generic type bases - #30
Merged
Merged
Conversation
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Reuse contextual type names for annotation generic bases while preserving ordinary value subscripts and legacy print-statement parsing. Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Retain the verified contextual-base source tree while recording the released prerequisite as an ancestor. Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
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.
Why
Annotations such as
value: match[int]retain a value-subscript tree and miss the type captures expected from a generic annotation. Recognizing these contextual names must also preserve ordinary modernprint[...]expressions and supported Python2 statements.Requirements
Customer Summary
Generic annotations recognize
match,print,execandlazyas type bases. Ordinary value subscripts keep their expression trees. Valid type-parameter bounds namedprintorexecalso parse successfully.Technical Summary
generic_typereuses_default_member_base. Contextualprint/exectype names use the existing keyword-identifier priority, and explicit ambiguities retain the value/legacy-print and list-splat alternatives. README documents the annotation behavior and the next major crate version. Review the shared type-parameter-name priority against ordinary print statements and expression contexts.Testing
src/byte for byte;bun run verifyand the contextual-base and comparison-operand tests passed. Full CI runs the complete suite.Notes
This is a breaking annotation-AST and highlighting change. Seven pre-existing code-gauge errors and 46 warnings remain outside changed code:
GrammarTests.testFuncdefin both Python2 variants (159 NCSS each), the corresponding function in both Python3 variants (187 each), the Python3.8 example file (1,200 NCSS) and itstest_funcdef(232 NCSS), and external scanner dispatch (complexity 175/202 NCSS). Refactoring imported fixtures or the unrelated scanner would expand this type-base change. The intentional LF/CRLF fixture duplicates would be suitable for a code-gauge exclusion; no configuration exclusion is added. Runtime 2.x remains required.