<div dir="ltr">In swift 3.0 beta 3, I defined a fairly simple protocol and two structs that implement it, if I initialize the array when creating the objects, it works, but if I try to add elements I get an error:<div><br></div><div>Cannot convert value of type '[H]' to expected argument type 'inout _'<br><div><br></div><div>Shouldn't this work?</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(187,44,162)"><span style="font-variant-ligatures: no-common-ligatures;">protocol</span><span style="color:rgb(0,0,0)"> H {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(187,44,162)">var</span><span style="font-variant-ligatures: no-common-ligatures;"> v : </span><span style="color:rgb(112,61,170)">Int</span><span style="font-variant-ligatures: no-common-ligatures;"> { </span><span style="color:rgb(187,44,162)">get</span><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(187,44,162)">set</span><span style="font-variant-ligatures: no-common-ligatures;"> }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(187,44,162)">func</span><span style="font-variant-ligatures: no-common-ligatures;"> hello()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;">}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures: no-common-ligatures;"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(187,44,162)">struct</span><span style="font-variant-ligatures: no-common-ligatures;"> J : </span><span style="color:rgb(79,129,135)">H</span><span style="font-variant-ligatures: no-common-ligatures;"> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(187,44,162)">var</span><span style="font-variant-ligatures: no-common-ligatures;"> v : </span><span style="color:rgb(112,61,170)">Int</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(187,44,162)">func</span><span style="font-variant-ligatures: no-common-ligatures;"> hello() {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(61,29,129)">print</span><span style="font-variant-ligatures: no-common-ligatures;">(</span><span style="color:rgb(209,47,27)">"j"</span><span style="font-variant-ligatures: no-common-ligatures;">)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;">}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures: no-common-ligatures;"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(187,44,162)">struct</span><span style="font-variant-ligatures: no-common-ligatures;"> K : </span><span style="color:rgb(79,129,135)">H</span><span style="font-variant-ligatures: no-common-ligatures;"> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(187,44,162)">var</span><span style="font-variant-ligatures: no-common-ligatures;"> v : </span><span style="color:rgb(112,61,170)">Int</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(187,44,162)">func</span><span style="font-variant-ligatures: no-common-ligatures;"> hello() {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color:rgb(61,29,129)">print</span><span style="font-variant-ligatures: no-common-ligatures;">(</span><span style="color:rgb(209,47,27)">"k"</span><span style="font-variant-ligatures: no-common-ligatures;">)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;"> }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures: no-common-ligatures;">}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures: no-common-ligatures;"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(187,44,162)">let</span><span style="font-variant-ligatures: no-common-ligatures;"> ag:[</span><span style="color:rgb(79,129,135)">H</span><span style="font-variant-ligatures: no-common-ligatures;">] = [</span><span style="color:rgb(79,129,135)">K</span><span style="font-variant-ligatures: no-common-ligatures;">(v:</span><span style="color:rgb(39,42,216)">3</span><span style="font-variant-ligatures: no-common-ligatures;">), </span><span style="color:rgb(79,129,135)">J</span><span style="font-variant-ligatures: no-common-ligatures;">(v:</span><span style="color:rgb(39,42,216)">4</span><span style="font-variant-ligatures: no-common-ligatures;">)]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(79,129,135)">ag</span><span style="font-variant-ligatures: no-common-ligatures;">[</span><span style="color:rgb(39,42,216)">0</span><span style="font-variant-ligatures: no-common-ligatures;">].</span><span style="color:rgb(49,89,93)">hello</span><span style="font-variant-ligatures: no-common-ligatures;">()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(79,129,135)">ag</span><span style="font-variant-ligatures: no-common-ligatures;">[</span><span style="color:rgb(39,42,216)">1</span><span style="font-variant-ligatures: no-common-ligatures;">].</span><span style="color:rgb(49,89,93)">hello</span><span style="font-variant-ligatures: no-common-ligatures;">() //works</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures: no-common-ligatures;"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(187,44,162)">var</span><span style="font-variant-ligatures: no-common-ligatures;"> af:[</span><span style="color:rgb(79,129,135)">H</span><span style="font-variant-ligatures: no-common-ligatures;">] = []</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(79,129,135)">af</span><span style="font-variant-ligatures: no-common-ligatures;"> += [</span><span style="color:rgb(79,129,135)">K</span><span style="font-variant-ligatures: no-common-ligatures;">(v:</span><span style="color:rgb(39,42,216)">3</span><span style="font-variant-ligatures: no-common-ligatures;">)] // does not work</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(79,129,135)">af</span><span style="font-variant-ligatures: no-common-ligatures;"> += [</span><span style="color:rgb(79,129,135)">J</span><span style="font-variant-ligatures: no-common-ligatures;">(v:</span><span style="color:rgb(39,42,216)">4</span><span style="font-variant-ligatures: no-common-ligatures;">)]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(79,129,135)">af</span><span style="font-variant-ligatures: no-common-ligatures;">[</span><span style="color:rgb(39,42,216)">0</span><span style="font-variant-ligatures: no-common-ligatures;">].</span><span style="color:rgb(49,89,93)">hello</span><span style="font-variant-ligatures: no-common-ligatures;">()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(79,129,135)">af</span><span style="font-variant-ligatures: no-common-ligatures;">[</span><span style="color:rgb(39,42,216)">1</span><span style="font-variant-ligatures: no-common-ligatures;">].</span><span style="color:rgb(49,89,93)">hello</span><span style="font-variant-ligatures: no-common-ligatures;">() </span></p></div><div><span style="font-variant-ligatures: no-common-ligatures;"><br></span></div></div></div>