[swift-dev] SE-0095: SIL syntax and Any.self problem
joewillsher at icloud.com
Mon Jul 4 11:29:59 CDT 2016
I’ve been implementing SE-0095 <https://github.com/apple/swift-evolution/blob/master/proposals/0095-any-as-existential.md> (here <https://github.com/apple/swift/pull/3293>) and have hit an issue around how Any.self is treated.
When in the type position, I parse Any like any other type, and resolve it to be an empty protocol composition in the constraint system <https://github.com/apple/swift/pull/3293/files#diff-aee66a44df1b30cec188083399e31ec5R823>, in resolveTopLevelTypeComponent.
This does not work for metatype lookup, where the lookup is unconstrained and I need to find a ValueDecl for the Any type. Currently I have kept the stdlib’s typealias Any = protocol<> so the type system can look to the stdlib through getAnyDecl to find it. Does anyone have an idea about how this could be done without this; there are no other keywords that need this sort of unconstrained lookup and are implicitly declared?
Another question I had: does SE-0095 extend to SIL syntax? The proposal does’t mention it, but I think it would seem out of place to keep the protocol<> pattern in .sil if we are replacing it in .swift, the AST, and the demangler.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev