<div dir="ltr">Hey Chris already solved this for 2.2, it will now give you a fix-it to use [:]. So no need to file a bug :)</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">
<p><b><font color="#cc0000">___________________________________</font></b></p><p><b>James⎥Head of Trolls</b></p><p><b><font color="#cc0000"><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>⎥<a href="http://supmenow.com" target="_blank">supmenow.com</a></font></b></p><p><b><font size="2">Sup</font></b></p><p><b><font size="2">Runway East
</font></b></p><p><b><font size="2">10 Finsbury Square</font></b></p><p><b><font size="2">London</font></b></p><p><b><font size="2">
EC2A 1AF </font></b></p></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Mar 9, 2016 at 6:54 PM, Adriano Ferreira via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Dmitri, will do as you suggested.<br>
<br>
BTW, sorry for the typo... I actually intended "=" rather than “:", but luckily you got this :P<br>
<br>
Best,<br>
<br>
— A<br>
<div class="HOEnZb"><div class="h5"><br>
> On Mar 9, 2016, at 12:48 PM, Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>> wrote:<br>
><br>
> Hi Adriano,<br>
><br>
> On Wed, Mar 9, 2016 at 8:45 AM, Adriano Ferreira via swift-users<br>
> <<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br>
>> Hi everyone,<br>
>><br>
>> Does anyone know why Swift won’t let me use the alternative way below to<br>
>> init the dictionary?<br>
>><br>
>> public extension SequenceType where Self.Generator.Element: Hashable {<br>
>><br>
>> @warn_unused_result<br>
>> func frequencies() -> [Self.Generator.Element: Int] {<br>
>> var dictionary: [Self.Generator.Element: Int] = [:]<br>
>> // var dictionary: Dictionary<Self.Generator.Element, Int>() // <<<<br>
>> Not allowed!<br>
><br>
> It produces a bad error message, unfortunately. The issue is that you<br>
> have a ':' instead of '='.<br>
><br>
> But, that also fails. Only after I remove 'Self.' the compiler accepts it:<br>
><br>
> var dictionary = Dictionary<Generator.Element, Int>()<br>
><br>
> I would recommend you to file two issues on <a href="http://bugs.swift.org" rel="noreferrer" target="_blank">bugs.swift.org</a>, the first<br>
> one about a bad diagnostic for your code, and the second one about the<br>
> compiler rejecting "var dictionary =<br>
> Dictionary<Self.Generator.Element, Int>()" in the code above (when the<br>
> equal sign is used).<br>
><br>
> Dmitri<br>
><br>
> --<br>
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>
<br>
_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
</div></div></blockquote></div><br></div>