2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/types/typeRelationships/recursiveTypes/nominalSubtypeCheckOfTypeParameter.ts ===
|
|
|
|
interface Tuple<T, S> {
|
|
|
|
>Tuple : Tuple<T, S>
|
|
|
|
>T : T
|
|
|
|
>S : S
|
|
|
|
|
|
|
|
first: T
|
|
|
|
>first : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
second: S
|
|
|
|
>second : S
|
|
|
|
>S : S
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Sequence<T> {
|
|
|
|
>Sequence : Sequence<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
hasNext(): boolean
|
|
|
|
>hasNext : () => boolean
|
|
|
|
|
|
|
|
pop(): T
|
|
|
|
>pop : () => T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
zip<S>(seq: Sequence<S>): Sequence<Tuple<T, S>>
|
|
|
|
>zip : <S>(seq: Sequence<S>) => Sequence<Tuple<T, S>>
|
|
|
|
>S : S
|
|
|
|
>seq : Sequence<S>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Sequence : Sequence<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>S : S
|
2014-08-19 04:56:03 +02:00
|
|
|
>Sequence : Sequence<T>
|
|
|
|
>Tuple : Tuple<T, S>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
>S : S
|
|
|
|
}
|
|
|
|
|
|
|
|
// error, despite the fact that the code explicitly says List<T> extends Sequence<T>, the current rules for infinitely expanding type references
|
|
|
|
// perform nominal subtyping checks that allow variance for type arguments, but not nominal subtyping for the generic type itself
|
|
|
|
interface List<T> extends Sequence<T> {
|
|
|
|
>List : List<T>
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>Sequence : Sequence<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
getLength(): number
|
|
|
|
>getLength : () => number
|
|
|
|
|
|
|
|
zip<S>(seq: Sequence<S>): List<Tuple<T, S>>
|
|
|
|
>zip : <S>(seq: Sequence<S>) => List<Tuple<T, S>>
|
|
|
|
>S : S
|
|
|
|
>seq : Sequence<S>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Sequence : Sequence<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>S : S
|
2014-08-19 04:56:03 +02:00
|
|
|
>List : List<T>
|
|
|
|
>Tuple : Tuple<T, S>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
>S : S
|
|
|
|
}
|
|
|
|
|