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

Fix parsing error for propertyWrapper attributes

    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

      With empty arguments:

      @propertyWrapper
      struct TwelveOrLess {
          private var number: Int
          init() { self.number = 0 }
          var wrappedValue: Int {
              get { return number }
              set { number = min(newValue, 12) }
          }
      }
      
      struct SmallRectangle {
          @TwelveOrLess() // Parse error here because of empty parentheses "()"
          var height: Int
          @TwelveOrLess
          var width: Int
      }
      

      We should also parse:

      @A<Int> var a: Int
      @A.Nested(withValue: 42) var a: Int
      

        Attachments

          Activity

            People

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

              Dates

              Due:
              Created:
              Updated:
              Resolved: