-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong assertion for local variable shadowing helper #17370
Comments
Thanks for reporting this issue! I agree that the template snippet does not use the yielded block param in an invocation at all. @chancancode - Would you mind double checking my logic here? I don’t think this case was intended to get the assertion, right? |
Well, I think it's a bad idea to use a block param and shadow a helper, I like the error. We ran into this and changed our block param variable name. I thought the error was helpful, but it was a little confusing at first, then I read Perhaps the error needs to change to a warning?
|
@rwjblue yep this is a bug |
Previously we considered the block params to shadow the params, hash, attributes and named arguments on the same block/element, which was incorrect. Also fixes a bug where we incorrectly transformed mustaches in attribute positions: ```hbs {{#let ... as |foo|}} <div class={{foo bar}} /> {{/let}} ``` ...became... ```hbs {{#let ... as |foo|}} <div class={{component foo bar}} /> {{/let}} ``` This is clearly incorrect and has been fixed here as well. Fixes #17370
Previously we considered the block params to shadow the params, hash, attributes and named arguments on the same block/element, which was incorrect. For example: ```hbs {{#let (concat "foo" "bar") as |concat|}} ... {{/let}} ``` In this case the assertion code incorrectly believed the `concat` in the sub-expression invocation was being shadowed. This is now fixed. Also fixes a bug where we incorrectly transformed mustaches in attribute positions: ```hbs {{#let ... as |foo|}} <div class={{foo bar}} /> {{/let}} ``` ...became... ```hbs {{#let ... as |foo|}} <div class={{component foo bar}} /> {{/let}} ``` This is clearly incorrect and has been fixed here as well. Fixes #17370
Previously we considered the block params to shadow the params, hash, attributes and named arguments on the same block/element, which was incorrect. For example: ```hbs {{#let (concat "foo" "bar") as |concat|}} ... {{/let}} ``` In this case the assertion code incorrectly believed the `concat` in the sub-expression invocation was being shadowed. This is now fixed. Also fixes a bug where we incorrectly transformed mustaches in attribute positions: ```hbs {{#let ... as |foo|}} <div class={{foo bar}} /> {{/let}} ``` ...became... ```hbs {{#let ... as |foo|}} <div class={{component foo bar}} /> {{/let}} ``` This is clearly incorrect and has been fixed here as well. Fixes #17370
Previously we considered the block params to shadow the params, hash, attributes and named arguments on the same block/element, which was incorrect. For example: ```hbs {{#let (concat "foo" "bar") as |concat|}} ... {{/let}} ``` In this case the assertion code incorrectly believed the `concat` in the sub-expression invocation was being shadowed. This is now fixed. Also fixes a bug where we incorrectly transformed mustaches in attribute positions: ```hbs {{#let ... as |foo|}} <div class={{foo bar}} /> {{/let}} ``` ...became... ```hbs {{#let ... as |foo|}} <div class={{component foo bar}} /> {{/let}} ``` This is clearly incorrect and has been fixed here as well. Fixes #17370
Previously we considered the block params to shadow the params, hash, attributes and named arguments on the same block/element, which was incorrect. For example: ```hbs {{#let (concat "foo" "bar") as |concat|}} ... {{/let}} ``` In this case the assertion code incorrectly believed the `concat` in the sub-expression invocation was being shadowed. This is now fixed. Also fixes a bug where we incorrectly transformed mustaches in attribute positions: ```hbs {{#let ... as |foo|}} <div class={{foo bar}} /> {{/let}} ``` ...became... ```hbs {{#let ... as |foo|}} <div class={{component foo bar}} /> {{/let}} ``` This is clearly incorrect and has been fixed here as well. Fixes #17370
Previously we considered the block params to shadow the params, hash, attributes and named arguments on the same block/element, which was incorrect. For example: ```hbs {{#let (concat "foo" "bar") as |concat|}} ... {{/let}} ``` In this case the assertion code incorrectly believed the `concat` in the sub-expression invocation was being shadowed. This is now fixed. Also fixes a bug where we incorrectly transformed mustaches in attribute positions: ```hbs {{#let ... as |foo|}} <div class={{foo bar}} /> {{/let}} ``` ...became... ```hbs {{#let ... as |foo|}} <div class={{component foo bar}} /> {{/let}} ``` This is clearly incorrect and has been fixed here as well. Fixes #17370 (cherry picked from commit 1343d29)
Affected: Ember 3.6
Related PR: #17132
Code causing an issue:
Error raised:
Changing above code to:
passes compilation and does not raise an error.
Expected:
Original code should not raise an error as
changeset
is not invoked in the block.The text was updated successfully, but these errors were encountered: