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

Parse Error: function parameter can have attribute

    XMLWordPrintable

    Details

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

      Description

      func foo(@annotation par: Type) {}
      

      file Nimble/Nimble/DSL.swift, line 2

      public func expect<T>(@autoclosure(escaping) expression: () -> T?, file: String = __FILE__, line: UInt = __LINE__) -> Expectation<T> {
          return Expectation(
              expression: Expression(
                  expression: expression,
                  location: SourceLocation(file: file, line: line),
                  isClosure: true))
      }
      

      From xcode 6.3 release notes https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html#//apple_ref/doc/uid/TP40001051-CH4-SW3

      The @autoclosure attribute is now an attribute on a parameter, not an attribute on the parameter’s type.
      Where before you might have used:

      func assert(predicate : @autoclosure () -> Bool) {...}
      

      you now write this as:

      func assert(@autoclosure predicate : () -> Bool) {...}
      

        Attachments

          Activity

            People

            Assignee:
            elena.vilchik Elena Vilchik
            Reporter:
            elena.vilchik Elena Vilchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: