Repository navigation
fix: raw block helpers fail to compile with RelaxedHelperNaming enabled - #677
Merged
Merged
Conversation
…elperNaming With Compatibility.RelaxedHelperNaming enabled, IsUnregisteredBlockHelperName accepted the closing word of a raw block (e.g. /raw) and converted it into a block HelperExpression, so RawHelperAccumulator never found the closing tag and compilation failed. Reject block-close paths, as the other helper-name checks already do. Fixes #676 Co-Authored-By: Claude Opus 5.5 <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.



Problem
With
Compatibility.RelaxedHelperNaming = true, no raw block helper compiles. The compiler throwsReached end of template before raw block helper expression 'raw' was closed.HelperConverter.IsUnregisteredBlockHelperNameaccepted the closing word of a raw block (for example/raw) and turned it into a blockHelperExpression.RawHelperAccumulatorthen never found the closing tag, so it read to the end of the template and failed. With the default setting, theIsValidHelperLiteralcheck rejected/rawbefore it got this far, so the bug only showed up with relaxed naming on.Fix
IsUnregisteredBlockHelperNamenow returnsfalsefor block-close paths, the same wayIsRegisteredHelperNameandIsRegisteredBlockHelperNamealready do. A closing tag can never be the start of a block helper.Compatibility
Behavior with the default setting is unchanged. The new check only changes the result inside raw tags with
RelaxedHelperNamingon, which is the case that was broken.Tests
RawHelperTests.RawBlockHelperCompilesRegardlessOfRelaxedHelperNaming. It covers empty raw blocks, raw blocks with a mustache body, nested raw tags, and raw blocks with arguments, each with the setting both off and on. Before the fix the 4 relaxed cases failed.Fixes #676
🤖 Generated with Claude Code
Closes #676