[swift-dev] AutomaticEnumValueKind Tuple of Literals

Mohammed Ennabah ennabahm9 at gmail.com
Sat Nov 18 12:07:41 CST 2017

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 lib/Sema/TypeCheckDecl.cpp::3020 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..).
Now, my questions are:
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).
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.

- Mohammed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20171118/48cdbcf8/attachment.html>

More information about the swift-dev mailing list