title: Converting a file to Swift 3: unable to infer closure type in the current context
body: <p>I'm converting some library code in an app of mine, and I can't figure out how to convert this file from Swift 2.3 to Swift 3</p>
  
  <pre><code>import UIKit
  
  struct Constraint{
      var identifier: String?
  
      var attribute: NSLayoutAttribute = .centerX
      var secondAttribute: NSLayoutAttribute = .notAnAttribute
      var constant: CGFloat = 0
      var multiplier: CGFloat = 1
      var relation: NSLayoutRelation = .equal
  }
  
  func attributes(attrs:NSLayoutAttribute...) -&gt; [NSLayoutAttribute]{
      return attrs
  }
  
  infix operator &gt;&gt;- : MultiplicationPrecedence
  
  func &gt;&gt;- &lt;T: UIView&gt; (lhs: (T,T), apply: (inout Constraint) -&gt; () ) -&gt; NSLayoutConstraint {
      var const = Constraint()
      apply(&amp;const)
  
      const.secondAttribute = .notAnAttribute == const.secondAttribute ? const.attribute : const.secondAttribute
  
      let constraint = NSLayoutConstraint(item: lhs.0,
                                          attribute: const.attribute,
                                          relatedBy: const.relation,
                                          toItem: lhs.1,
                                          attribute: const.secondAttribute,
                                          multiplier: const.multiplier,
                                          constant: const.constant)
  
      constraint.identifier = const.identifier
  
      NSLayoutConstraint.activate([constraint])
      return constraint
  }
  
  func &gt;&gt;- &lt;T: UIView&gt; (lhs: T, apply: (inout Constraint) -&gt; () ) -&gt; NSLayoutConstraint {
      var const = Constraint()
      apply(&amp;const)
  
      let constraint = NSLayoutConstraint(item: lhs,
                                          attribute: const.attribute,
                                          relatedBy: const.relation,
                                          toItem: nil,
                                          attribute: const.attribute,
                                          multiplier: const.multiplier,
                                          constant: const.constant)
      constraint.identifier = const.identifier
  
      NSLayoutConstraint.activate([constraint])
      return constraint
  }
  
  func &gt;&gt;- &lt;T:UIView&gt; (lhs: (T,T),attributes: [NSLayoutAttribute]){
      for attribute in attributes{
          lhs &gt;&gt;- {
              $0.attribute = attribute
          }
      }
  }
  
  func &gt;&gt;- &lt;T:UIView&gt; (lhs: T, attributes: [NSLayoutAttribute]){
      for attribute in attributes{
          lhs &gt;&gt;- {
              $0.attribute = attribute
          }
      }
  }
  </code></pre>
  
  <p>The error is in the last two functions.</p>
  
  <pre><code>lhs &gt;&gt;- {
      $0.attribute = attribute
  }
  </code></pre>
  
  <p>Here is where it states "unable to infer closure type in the current context"</p>