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

Fix parsing error on "unsafeAddress" and "unsafeMutableAddress" accessors

    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

      Our parser fails on

        public var pointee: Pointee {
          @_transparent unsafeAddress {
            return self
          }
        }
      

      Which is invalid according to the Swift 5.3 official grammar (https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#grammar_variable-declaration), yet it is used in the Swift standard library:
      https://github.com/apple/swift/blob/main/stdlib/public/core/UnsafePointer.swift#L241

      These definitions in the Swift compiler might be relevant:
      https://github.com/apple/swift/blob/main/include/swift/AST/AccessorKinds.def#L165
      https://github.com/apple/swift/blob/main/include/swift/AST/AccessorKinds.def#L175

        Attachments

          Activity

            People

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

              Dates

              Due:
              Created:
              Updated:
              Resolved: