<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">(bcc'ing swift-evolution, adding swift-users)</div><div class=""><br class=""></div>This list is for language design discussion. If you have a bug, please file it at <a href="http://bugs.swift.org" class="">bugs.swift.org</a>, or discuss it on swift-users.<div class=""><br class=""></div><div class="">-Joe<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 18, 2016, at 10:11 AM, James Campbell via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class="">
<span style="font-size:12.8px" class="">I have a class that specifies a initialiser taking any class that implements the protocol "ChatDatastore"</span><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">I can use this fine in the functions for my test cases.</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">However if I try to initialise it in a member either statically, lazily or even via a computed variable it shows an error stating "Instance member 'chatDatastore' cannot be used on type 'ChatSessionRowViewModelTests'</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Not only is this confusing its plain wrong. I am passing in a Mock which implements this protocol for the purposes of testing.</div><div style="font-size:12.8px" class=""><br class=""></div><p class=""><span style="font-size:12.8px" class="">This should work yet it seems to think that the initializer takes a totally different type than specified in the code. It should accept my Mock class since it implements this protocol yet it complains that I need to give it an instance of my testing class. Which makes no sense :S</span></p><p class=""><b class=""><font color="#cc0000" class="">___________________________________</font></b></p><p class=""><b class="">James⎥Head Of CEO</b></p><p class=""><b class=""><font color="#cc0000" class=""><a href="mailto:james@supmenow.com" target="_blank" class="">james@supmenow.com</a>⎥<a href="http://supmenow.com/" target="_blank" class="">supmenow.com</a></font></b></p><p class=""><b class=""><font size="2" class="">Sup</font></b></p><p class=""><b class=""><font size="2" class="">Runway East
</font></b></p><p class=""><b class=""><font size="2" class="">10 Finsbury Square</font></b></p><p class=""><b class=""><font size="2" class="">London</font></b></p><p class=""><b class=""><font size="2" class="">
EC2A 1AF </font></b></p></div></div></div></div></div></div></div></div></div>
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>