Uploaded image for project: 'SonarSwift'
  1. SonarSwift
  2. SONARSWIFT-469

Fix parsing error on prefix and postfix operators followed by infix-operator-group

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3
    • Component/s: Parser
    • Labels:
      None

      Description

      Swift standard library contains examples of prefix and postfix operators followed by infix-operator-group (see https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#grammar_operator-declaration), even though the official specification disallows it.
      For example:

      postfix operator ... : Comparable
      prefix operator ! : Bool
      prefix operator ~ : BinaryInteger
      prefix operator + : AdditiveArithmetic
      prefix operator - : SignedNumeric
      prefix operator ... : Comparable
      prefix operator ..< : Comparable
      

      One of the early usages:
      https://github.com/apple/swift/pull/20659/files

      Might be related to https://github.com/apple/swift-evolution/blob/master/proposals/0077-operator-precedence.md

        Attachments

          Activity

            People

            Assignee:
            massimo.paladin Massimo PALADIN
            Reporter:
            arseniy.zaostrovnykh Arseniy Zaostrovnykh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: