2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughTypeInference.ts ===
|
|
|
|
interface G<T> {
|
|
|
|
>G : G<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
x: G<G<T>> // infinitely expanding type reference
|
|
|
|
>x : G<G<T>>
|
2014-08-19 04:56:03 +02:00
|
|
|
>G : G<T>
|
|
|
|
>G : G<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
y: T
|
|
|
|
>y : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
|
|
|
|
function ff<T>(g: G<T>): void {
|
|
|
|
>ff : <T>(g: G<T>) => void
|
|
|
|
>T : T
|
|
|
|
>g : G<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>G : G<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
ff(g) // when infering T here we need to make sure to not descend into the structure of G<T> infinitely
|
|
|
|
>ff(g) : void
|
|
|
|
>ff : <T>(g: G<T>) => void
|
|
|
|
>g : G<T>
|
|
|
|
}
|
|
|
|
|
|
|
|
|