[swift-evolution] Potential Bug with Compiler in 2.1.1 and UnitTests

Joe Groff jgroff at apple.com
Fri Mar 18 12:42:32 CDT 2016


(bcc'ing swift-evolution, adding swift-users)

This list is for language design discussion. If you have a bug, please file it at bugs.swift.org, or discuss it on swift-users.

-Joe

> On Mar 18, 2016, at 10:11 AM, James Campbell via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> I have a class that specifies a initialiser taking any class that implements the protocol "ChatDatastore"
> 
> I can use this fine in the functions for my test cases.
> 
> 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'
> 
> Not only is this confusing its plain wrong. I am passing in a Mock which implements this protocol for the purposes of testing.
> 
> 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
> 
> ___________________________________
> 
> James⎥Head Of CEO
> 
> james at supmenow.com <mailto:james at supmenow.com>⎥supmenow.com <http://supmenow.com/>
> Sup
> 
> Runway East
> 
> 
> 10 Finsbury Square
> 
> London
> 
> 
> EC2A 1AF 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160318/49667a4e/attachment.html>


More information about the swift-evolution mailing list