title: Array initializer shorthand with optional values in Swift
body: <p>I was trying to initialize an array containing optional values using the repeatedValues initializer and I was surprised to discover the following code doesn't compile</p>
  
  <pre class="lang-swift prettyprint-override"><code>let a: Int?[] = Int?[](count: 10, repeatedValue:nil)
  // error - Value of Int?[]? not unwrapped; did you mean to use '!' or '?'?
  </code></pre>
  
  <p>What's interesting is that type signature <code>Int?[]?</code>, e.g. an optional <code>Array</code> of optional <code>Int</code>. This feels like a bug but maybe there's something I'm missing about the grammar. I've looked through the language reference some but have yet to find an answer.</p>
  
  <p>The more explicit <code>Array&lt;Int?&gt;</code> type initializer works as expected</p>
  
  <pre class="lang-swift prettyprint-override"><code>let b: Int?[] = Array&lt;Int?&gt;(count: 10, repeatedValue:nil)
  // compiles fine
  </code></pre>
  
  <p>Has anyone else run into this and can shed some light?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Couple extra working examples with non-optional types to highlight the failure</p>
  
  <pre class="lang-swift prettyprint-override"><code>let c: Int[] = Int[](count: 10, repeatedValue:0)
  // non-optional shorthand works fine
  
  class D { var foo = 1 }
  let d: D[] = D[](count:10, repeatedValue:D())
  // custom class works fine using the shorthand too
  
  enum E { case a, b, c, d, e }
  let e: E[] = E[](count:10, repeatedValue:.e)
  // enums work too
  </code></pre>