<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Mohammed,<div class=""><br class=""></div><div class="">The ‘automatic enum value’ code path is used if you have code like this, where you declare a raw type but don’t assign raw values:</div><div class=""><br class=""></div><div class="">enum E : Int {<br class="">&nbsp;&nbsp;case a<br class="">&nbsp;&nbsp;case b<br class="">&nbsp;&nbsp;case c<br class="">}</div><div class=""><br class=""></div><div class="">This only makes sense for a raw type of integer, and not string — or a tuple. Even if you have (Int, Int) as your raw type, it’s not clear how to automatically increment such a value, so I think you shouldn’t be hitting this code path at all if you have a tuple raw type.</div><div class=""><br class=""></div><div class="">Slava<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 18, 2017, at 1:07 PM, Mohammed Ennabah via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I have been digging into the Swift library to solve the case where enum could have a RawValue of tuples of literals. So far, I found that in&nbsp;<span class="">lib/Sema/TypeCheckDecl.cpp::3020</span>&nbsp;we do check the enum RawValue if it conforms to a knownProtocolKind, and if true, we switch over to check whether it’s ExpressibleByXXLiteral (XX could be String, Integer, etc..).<div class="">Now, my questions are:</div><div class=""><ul class="MailOutline"><li class="">I need to extend this condition to have a tuple of types that conforms to the knownProtocolKind, and I’m not quite sure where to start. (Note: It’s better to make the tuple conforms to a protocol type that is knownProtocolKind, so the enum can be tuple of tuples.., let me know your thoughts please).</li><li class="">We increment the RawValue if it’s of type Integer. What if the tuple of type (Int, String), will we need to increment the Int part as well? I think yes, but I’m asking to listen to your thoughts, too.</li></ul><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">- Mohammed</div></div>_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></div></body></html>