Convert type keywords inside array types (#132) - #157
Merged
Merged
Conversation
TypeNameParser's grammar had no rule for array brackets, so any type name ending in "[]" failed to parse and was returned verbatim, skipping the String -> string style conversions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.
Fixes #132.
Problem
Type keyword conversions (
String→string,Integer→int, etc.) were skipped whenever the type name was an array:converted to
String[] Lemmatize(String[] toks, String[] tags)instead of usingstring[].Cause
TypeNameParser's grammar had no production for array brackets. After parsing the identifier, the[token remained, soParseTypeNamehit its "extra tokens" fallback and returned the input verbatim — bypassing the conversion table entirely.Fix
Added an
ArraySuffix()rule and applied it after both the plain-identifier and generic branches ofTypeName(), so brackets are consumed forString[],String[][],MyType<String>[], andList<String[]>alike.TypeName()was flattened to an early-return shape so both branches share the suffix handling.Grammar is now:
Tests
Written TDD — the new tests fail on
masterand pass with the fix. Added a theory covering the array shapes above plus a non-converted type (MyType[]), and an end-to-end test of the issue's exact method signature. Full suite: 273 passing.🤖 Generated with Claude Code