[swift-evolution] Compile time assertion / checking?

Joe Groff jgroff at apple.com
Tue Dec 22 09:18:48 CST 2015


> On Dec 21, 2015, at 11:18 PM, Jens Persson <jens at bitcycle.com> wrote:
> 
> Thanks!
> (As a side note related to overflow, I filed https://bugs.swift.org/browse/SR-297 <https://bugs.swift.org/browse/SR-297> demonstrating that a
> T : UnsignedIntegerType can be set to eg literal -1 without trapping the overflow.)

Thanks! Yeah, we only ever handled overflow in concrete integer types. Compile-time diagnostics for protocol invariants would be another interesting thing to add. It might be possible by refactoring how IntegerLiteralConvertible interfaces with _BuiltinIntegerLiteralConvertible, making the diagnostics occur while narrowing Builtin.Int2048 to the literal type.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151222/23381310/attachment.html>


More information about the swift-evolution mailing list