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

James Campbell james at supmenow.com
Fri Mar 18 12:11:25 CDT 2016


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 <james at supmenow.com>⎥supmenow.com <http://supmenow.com>*

*Sup*

*Runway East *

*10 Finsbury Square*

*London*

* EC2A 1AF *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160318/a0078bee/attachment.html>


More information about the swift-evolution mailing list