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

Confusing "variable not in scope" error #397

Open
LightAndLight opened this issue May 9, 2023 · 0 comments
Open

Confusing "variable not in scope" error #397

LightAndLight opened this issue May 9, 2023 · 0 comments
Labels
UX User experience.

Comments

@LightAndLight
Copy link
Owner

path : String
path = "example.com"

main : IO ()
main = println "https://$path?key=value"

Output:

$ ipso test.ipso
test.ipso:5:26: error: variable not in scope
  |
5 | main = println "https://$path?key=value"
  |                          ^

I felt confused when debugging a similar error. I looked at Ipso's error message, and thought to myself, "Why? path is in scope." After a few minutes, I realised I had forgotten that Ipso allows ? and ! in variable names, so the error was telling me that the variable path?key was not in scope, which is true. To fix the error, I need to write "https://${path}?key=value" so that the ? is treated literally.

If the caret in the error message was actually a span then I would have noticed this instantly:

$ ipso test.ipso
test.ipso:5:26: error: variable not in scope
  |
5 | main = println "https://$path?key=value"
  |                          ^~~~~~~~
@LightAndLight LightAndLight added the UX User experience. label May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UX User experience.
Projects
None yet
Development

No branches or pull requests

1 participant