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

Environment unduly dropped in interpolated strings #170

Closed
yannham opened this issue Oct 15, 2020 · 0 comments · Fixed by #173
Closed

Environment unduly dropped in interpolated strings #170

yannham opened this issue Oct 15, 2020 · 0 comments · Fixed by #173
Assignees

Comments

@yannham
Copy link
Member

yannham commented Oct 15, 2020

Describe the bug
If one uses variables inside an interpolated expression in the middle of a string, this causes an unexpected "unbound identifier" error. As often with these errors, an environment is probably getting dropped somewhere where it shouldn't.

To Reproduce
Use a variable as an interpolated expression somewhere in the middle of a string:

$nickel <<< '
  let world = "world" in
  "Hello, ${world}!"
'
error: Unbound identifier
  ┌─ <stdin>:3:11
  │
3 │ "Hello, ${world}!"
  │           ^^^^^ this identifier is unbound

Note that the error is not triggered if the variable is alone in the string:

$nickel <<< 'let x = "a" in "${x}"'
Done: Str("a")

Expected behavior
Variables in scope should be accessible in interpolated string. The first example should succeed with result "Hello, world!".

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

Successfully merging a pull request may close this issue.

1 participant