fix: UpperCamelCaseExpressionNameResolver no longer breaks #each (issue #582)#634
Merged
Conversation
… (issue #582) Add Issue582Tests covering the case where UpperCamelCaseExpressionNameResolver is configured and #each is used with arrays and lists. Includes tests for @index/@FIRST metadata, nested property access, string arrays, and nested #each blocks. All scenarios pass with the current resolver and path-resolution logic, which uses case-insensitive property lookup via LowerInvariant throughout. Co-Authored-By: Claude Sonnet 4.6 <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 #582
Summary
source/Handlebars.Test/Issues/Issue582Tests.cswith 7 regression tests coveringUpperCamelCaseExpressionNameResolver+#eachinteraction#eachiteration over arrays or lists, including scenarios with@index/@firstmetadata, nested property access, string arrays, and nested#eachblocksAnalysis
The bug was reported as
{{#each items}}{{name}}{{/each}}producing wrong output whenExpressionNameResolver = new UpperCamelCaseExpressionNameResolver()is configured.After tracing through the code, the current resolver is safe because:
ReflectionMemberAccessor.GetValueGetter) compares againstChainSegment.LowerInvariantusingOrdinalIgnoreCase, soChainSegment("Name")andChainSegment("name")resolve to the same property.ChainSegmentEqualityComparerwhich also compares byLowerInvariant, so resolver-transformed segments still match the stored well-known variables.this,@index,@key,@first,@last,@root) go through code paths that never callResolveMemberName(the only place the resolver is invoked).The tests lock in this correct behavior to catch any future regression.
Test plan
🤖 Generated with Claude Code