Skip to content

[SR-6909] libSyntax doesn't know about operator precedence #49458

@dabrahams

Description

@dabrahams
Previous ID SR-6909
Radar None
Original Reporter @dabrahams
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, Syntax
Assignee None
Priority Medium

md5: 2493838608afee26863c2c17f96fb301

Issue Description:

If you want to line-break an expression, you want to break it near lower-precedence operators, so you end up with

longThing1 * longThing2
+ longThing3 * longThing4

rather than

longThing1 * longThing2 + longThing3
   * longThing4

or worse:

longThing1
    * longThing2 + longThing3
    * longThing4

But libSyntax is flattening all of that into SequenceExprSyntax so that information is lost. I realize that file-at-a-time processing can't always do this reliably, but... it could try. And it could know about the precedences in the standard library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerThe Swift compiler itselfdeclarationsFeature: declarationsexpressionsFeature: expressionsfeatureA feature request or implementationoperatorsFeature: operatorsprecedence groupsFeature → operators: precedence groupsstaleResolution: No longer relevant, stale† libswiftSyntaxArchive • Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions