dduan
(Daniel Duan)
1
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
jtbandes
(Jacob Bandes-Storch)
2
You might find BoundGenericType useful:
Jacob Bandes-Storch
···
On Mon, Jan 11, 2016 at 2:31 PM, Daniel Duan via swift-dev < swift-dev@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev
dduan
(Daniel Duan)
3
BoundGenericType::getGenericArgs() is exactly what I was looking for. Thanks Jacob!
···
On Jan 11, 2016, at 2:34 PM, Jacob Bandes-Storch <jtbandes@gmail.com> wrote:
You might find BoundGenericType useful:
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@swift.org <mailto:swift-dev@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@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev