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

Fix parsing error: protocol subscript declaration with where-clause

    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

      protocol P {
          subscript<T>(key: Key) -> T? where T: Foo { get } // fails here, before "where"
      }
      

      We are not sure in which version this feature was added. In grammar of Swift 3.0 there is no where-clause (while it does not mean it was not supported as this grammar is not always precise):
      protocol-subscript-declaration → subscript-headsubscript-resultgetter-setter-keyword-block

      Still in recent docs we see:
      protocol-subscript-declaration → subscript-head subscript-result generic-where-clause opt getter-setter-keyword-block

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              margarita.nedzelska Margarita Nedzelska
              Reporter:
              elena.vilchik Elena Vilchik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: