[swift-evolution] Compile time assertion / checking?
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:
> (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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution