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

Empty {} in string interpolation should fail #261

Open
JohnnyMorganz opened this issue Jan 4, 2023 · 3 comments
Open

Empty {} in string interpolation should fail #261

JohnnyMorganz opened this issue Jan 4, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@JohnnyMorganz
Copy link
Collaborator

#253

local _ = `asdf{}`

This currently passes, but it should fail.
Luau errors with "SyntaxError: Malformed interpolated string, expected expression inside '{}"

@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Jan 4, 2023
@jeparlefrancais
Copy link
Contributor

I don't know if it's preferable to create another issue but I also noticed that the string { {} } does not parse in full-moon in the latest version:

unexpected double brace for interpolated string. try \\{ if you meant to escape

But if you give it a try on https://luau-lang.org/demo, it does work:

image

@Kampfkarren
Copy link
Owner

That actually probably shouldn't work in Luau either... :P

But c'est la vie

@jeparlefrancais
Copy link
Contributor

jeparlefrancais commented May 8, 2023

Yeah I don't know where I sit with if it should or shouldn't, but I do believe it's a little confusing to work with because it's very hard to predict this:

local _ = `{{ }}` -- err
local _ = `{ {}}` -- ok
local _ = `{--[[]]{}}` -- ok
local _ = `\{{true}` -- ok
local _ = `{{hello}}` -- err
local _ = `{ {hello}}` -- ok
local _ = `\{{hello}}` -- ok

😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants