[swift-dev] Help: Get Generic Pattern Detail From TypeDecl in AST

Daniel Duan daniel at duan.org
Mon Jan 11 17:32:05 CST 2016


BoundGenericType::getGenericArgs() is exactly what I was looking for. Thanks Jacob!

> On Jan 11, 2016, at 2:34 PM, Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
> 
> You might find BoundGenericType useful:
> 
> https://github.com/apple/swift/blob/5aa40dd0aa057591398339c77df91a976ae35c72/include/swift/AST/Types.h#L1438 <https://github.com/apple/swift/blob/5aa40dd0aa057591398339c77df91a976ae35c72/include/swift/AST/Types.h#L1438>
> 
> Jacob Bandes-Storch
> 
> On Mon, Jan 11, 2016 at 2:31 PM, Daniel Duan via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
> Hi all,
> 
> Working on a swiftc crash in the type checker, I’m having a hard time with getting generic type pattern in the AST. For example, say we have parsed:
> 
> struct Y<T> {}
> struct X<T, U> {
>   let a: Y<T>
>   let b: Y<U>
> }
> 
> 
> In the AST, the type of member “a” would be  “Y<T>". But I can’t figure out how to inspect the inner “T” from the TypeDecl instance that represents a’s type.
> 
> What am I missing here?
> 
> - Daniel
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org <mailto:swift-dev at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-dev <https://lists.swift.org/mailman/listinfo/swift-dev>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160111/52b6bcf4/attachment.html>


More information about the swift-dev mailing list