emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.46k stars 4.21k forks source link

[beta] Negative integer literal causes null reference in positional params #15480

Closed ef4 closed 6 years ago

ef4 commented 6 years ago

In ember beta, a component invocation like this:

{{my-component "a-string-literal" (num-plus 1 -1) }}

Throws an exception. If you change the negative one to a positive number, the exception goes away.

The exception seems to be that the first positional parameter (in this above case, the string literal) is replaced with a null reference in the positional arguments handled by glimmer. The stack trace is:

TypeError: Cannot read property 'tag' of null
    at combineTagged (reference.js:141)
    at PositionalArguments.get (runtime.js:500)
    at combineTagged (reference.js:141)
    at Arguments.get (runtime.js:443)
    at Arguments.capture (runtime.js:426)
    at CurlyComponentManager.prepareArgs (curly.js:126)
    at runtime.js:1631
    at AppendOpcodes.evaluate (runtime.js:70)
    at VM.next (runtime.js:7223)
    at TemplateIterator.next (runtime.js:7294)

Reproduction repo: https://github.com/ef4/ember-params-bug

cibernox commented 6 years ago

@ef4 This is a dup of https://github.com/emberjs/ember.js/issues/15470

cibernox commented 6 years ago

Although it's good to know that it's not only related with actions and helpers are also affected

ef4 commented 6 years ago

Thanks, I saw that issue but wasn't sure it covered the same case. Now I notice "negative" there, and I agree.

On Sat, Jul 8, 2017 at 2:19 PM Miguel Camba notifications@github.com wrote:

Although it's good to know that it's not only related with actions and helpers are also affected

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/emberjs/ember.js/issues/15480#issuecomment-313875783, or mute the thread https://github.com/notifications/unsubscribe-auth/AATfMrzjdY3NpDGBS0LF3L72T4xvrL7Cks5sL9Y8gaJpZM4ORvip .

Serabe commented 6 years ago

Closing as dup. Thank you!