title: Using trailing closure in for-in loop
body: <p>I'm using <code>map()</code> function of array in for-in loop like this:</p>
  
  <pre><code>let numbers = [2, 4, 6, 8, 10]
  
  for doubled in numbers.map { $0 * 2 } // compile error
  {
      print(doubled)
  }
  </code></pre>
  
  <p>which produces compile error:</p>
  
  <blockquote>
    <p>Use of unresolved identifier 'doubled'</p>
  </blockquote>
  
  <p>However, if I put parenthesis for <code>map()</code> function, it works fine. i.e.</p>
  
  <pre><code>for doubled in numbers.map ({ $0 * 2 })
  {
      print(doubled)
  }
  </code></pre>
  
  <p>My question is, why wouldn't compiler differentiate code block of trailing function and loop, assuming this is causing the problem?</p>