Skip to content

fix: UpperCamelCaseExpressionNameResolver no longer breaks #each (issue #582)#634

Merged
rexm merged 3 commits into
masterfrom
worktree-agent-a37703f35634225b9
Jun 20, 2026
Merged

fix: UpperCamelCaseExpressionNameResolver no longer breaks #each (issue #582)#634
rexm merged 3 commits into
masterfrom
worktree-agent-a37703f35634225b9

Conversation

@rexm

@rexm rexm commented Jun 20, 2026

Copy link
Copy Markdown
Member

Fixes #582

Summary

  • Adds source/Handlebars.Test/Issues/Issue582Tests.cs with 7 regression tests covering UpperCamelCaseExpressionNameResolver + #each interaction
  • Tests confirm the resolver does not break #each iteration over arrays or lists, including scenarios with @index/@first metadata, nested property access, string arrays, and nested #each blocks

Analysis

The bug was reported as {{#each items}}{{name}}{{/each}} producing wrong output when ExpressionNameResolver = new UpperCamelCaseExpressionNameResolver() is configured.

After tracing through the code, the current resolver is safe because:

  1. Member access (ReflectionMemberAccessor.GetValueGetter) compares against ChainSegment.LowerInvariant using OrdinalIgnoreCase, so ChainSegment("Name") and ChainSegment("name") resolve to the same property.
  2. Context data lookups use ChainSegmentEqualityComparer which also compares by LowerInvariant, so resolver-transformed segments still match the stored well-known variables.
  3. Reserved names (this, @index, @key, @first, @last, @root) go through code paths that never call ResolveMemberName (the only place the resolver is invoked).

The tests lock in this correct behavior to catch any future regression.

Test plan

  • All 7 new tests pass
  • All 1753 tests pass (1746 pre-existing + 7 new)

🤖 Generated with Claude Code

rexm and others added 2 commits June 20, 2026 08:32
… (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>
@rexm rexm enabled auto-merge June 20, 2026 12:54
@sonarqubecloud

Copy link
Copy Markdown

@rexm rexm merged commit fb66343 into master Jun 20, 2026
7 checks passed
@rexm rexm deleted the worktree-agent-a37703f35634225b9 branch June 20, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UpperCamelCaseExpressionNameResolver configuration causing issues while working with HL7.FHIR.R4 version 5.5.1 in Handlebar.net

1 participant