Skip to content

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

Open
@munificent

Description

@munificent

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions