Skip to content
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

Desugaring of +: for field name expressions incorrectly binds self #244

Closed
sparkprime opened this issue Oct 11, 2016 · 1 comment
Closed
Labels

Comments

@sparkprime
Copy link
Contributor

$ jsonnet -e '{ field: {accumulator: []} { [self.f] +: [1] }, f: "accumulator" }'
RUNTIME ERROR: Field does not exist: f
        <cmdline>:1:31-36       object <anonymous>
        <cmdline>:1:10-46       object <anonymous>
        During manifestation

Because the desugaring yields

{ field: {accumulator: []} { [self.f] : super[self.f] + [1] }, f: "accumulator" }

whereas it should yield something like

{ field: {accumulator: []} (local outer = self; { [self.f] : super[outer.f] + [1] }), f: "accumulator" }
@sparkprime sparkprime added the bug label Oct 11, 2016
@sparkprime
Copy link
Contributor Author

Also super, which cannot be hoisted out to an 'outer' var so we'll have to hoist out at least every expression e in [e] +: ... where e contains self or super.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant