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

Make sure to preserve a space between ? and . #1642

Open
munificent opened this issue Feb 7, 2025 · 0 comments
Open

Make sure to preserve a space between ? and . #1642

munificent opened this issue Feb 7, 2025 · 0 comments

Comments

@munificent
Copy link
Member

We're working on two new language features:

These two features can be combined:

var list = <double>[? .infinity];

It's sort of like we're adding two new prefix operators (though the . isn't really a prefix operator). However, there is already a ?. operator and the lexical grammar tokenizes that as a single unit.

This means that if the formatter encounters a shorthand .foo expression inside a null-aware element ? expression, it must preserve a space between the ? and .. We have a similar edge case in the formatter around preserving a space between chained unary - operators like - -a so that it doesn't accidentally turn them into a prefix decrement.

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

No branches or pull requests

1 participant