[swift-users] Compile time tests

José Manuel Sánchez buscarini at gmail.com
Fri Mar 31 02:44:55 CDT 2017

I don’t know if this has come before (I tried searching but it’s not easy with the mailing lists system); sorry in advance if that’s the case.

I’ve been using more generics lately, and I’ve come to a point where it would be really nice to check if my types are correctly specified so that a wrong combination isn’t possible because the compiler will not allow it. The problem is, I can’t do this using unit testing, because if everything is correct, the code won’t compile, and then the tests will fail. I’m guessing there’s currently no way to do this? I did some googling and I only found something like this for boost (compile-fail):

http://www.boost.org/build/doc/html/bbv2/builtins/testing.html <http://www.boost.org/build/doc/html/bbv2/builtins/testing.html>

José Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170331/b9a837f5/attachment.html>

More information about the swift-users mailing list