[swift-dev] Generic Subscripting
Douglas Gregor
dgregor at apple.com
Wed Mar 2 22:57:02 CST 2016
> On Mar 2, 2016, at 6:17 PM, Stephen Celis <stephen.celis at gmail.com> wrote:
>
> Hello, swift-dev!
>
> I started diving into the Swift code base in December to see if I could wire together generic subscripts (https://bugs.swift.org/browse/SR-115), but I didn't have the time or know-how to get very far. I jumped back in again this past week and some of my earlier work was made obsolete by Chris's DeclContext plumbing at the end of last year :)
>
> Michael Ilseman (cc'd) also started working on this but I don't think he had time to get much farther.
>
> Last weekend I rebased, updated my code, and pushed a branch that seems to satisfy the general lexer:
>
> https://github.com/apple/swift/compare/master...stephencelis:generic-subscripts
>
> I am, however, having a bit of trouble finding my way around the type checker and constraint generator. Trying to compile a simple example fails with this assertion: https://gist.github.com/stephencelis/10f9210a5409ee9bd79b
You need to make sure that ConstraintSystem::getTypeOfMemberReference “opens” the generic type of the subscript. The easiest way might be to make sure that the interface type of a generic subscript operator is a GenericFunctionType.
- Doug
More information about the swift-dev
mailing list