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

Invalid map optimization result in unreliable subscript resolution #25

Closed
r3c opened this issue Mar 15, 2020 · 1 comment
Closed

Invalid map optimization result in unreliable subscript resolution #25

r3c opened this issue Mar 15, 2020 · 1 comment
Assignees

Comments

@r3c
Copy link
Owner

r3c commented Mar 15, 2020

Version: 1.6.1

Code:

var document = Document.CreateDefault("{[x: 42][0]}");
var context = Context.CreateCustom(new Dictionary<Value, Value> { ["x"] = 0 });

return document.DocumentOrThrow.Render(context);

Expected result:
"42"

Actual result:
string.Empty

Description:
Document optimizer performs invalid optimization of maps with non-constant indices and constant subscript. In the example above, it will assume map doesn't contain a value at index 0 while variable x can take this value at render time, making the assumption wrong.

@r3c
Copy link
Owner Author

r3c commented Mar 15, 2020

Introduced by 9dcb205, fixed in d5078d8.

@r3c r3c closed this as completed Mar 15, 2020
@r3c r3c self-assigned this Mar 15, 2020
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

No branches or pull requests

1 participant