Test:Mutually recursive types do not recur infinitely

This commit is contained in:
Nathan Shively-Sanders
2017-12-01 15:00:37 -08:00
parent dc24f77741
commit 7cfe6a4cdb
5 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
tests/cases/compiler/mutuallyRecursiveInference.ts(2,27): error TS2536: Type '"a"' cannot be used to index type 'RT'.
==== tests/cases/compiler/mutuallyRecursiveInference.ts (1 errors) ====
interface T<A> { a: A }
interface L<RT> extends T<RT['a']> {}
~~~~~~~
!!! error TS2536: Type '"a"' cannot be used to index type 'RT'.
interface X extends L<X> {}

View File

@@ -0,0 +1,7 @@
//// [mutuallyRecursiveInference.ts]
interface T<A> { a: A }
interface L<RT> extends T<RT['a']> {}
interface X extends L<X> {}
//// [mutuallyRecursiveInference.js]

View File

@@ -0,0 +1,18 @@
=== tests/cases/compiler/mutuallyRecursiveInference.ts ===
interface T<A> { a: A }
>T : Symbol(T, Decl(mutuallyRecursiveInference.ts, 0, 0))
>A : Symbol(A, Decl(mutuallyRecursiveInference.ts, 0, 12))
>a : Symbol(T.a, Decl(mutuallyRecursiveInference.ts, 0, 16))
>A : Symbol(A, Decl(mutuallyRecursiveInference.ts, 0, 12))
interface L<RT> extends T<RT['a']> {}
>L : Symbol(L, Decl(mutuallyRecursiveInference.ts, 0, 23))
>RT : Symbol(RT, Decl(mutuallyRecursiveInference.ts, 1, 12))
>T : Symbol(T, Decl(mutuallyRecursiveInference.ts, 0, 0))
>RT : Symbol(RT, Decl(mutuallyRecursiveInference.ts, 1, 12))
interface X extends L<X> {}
>X : Symbol(X, Decl(mutuallyRecursiveInference.ts, 1, 37))
>L : Symbol(L, Decl(mutuallyRecursiveInference.ts, 0, 23))
>X : Symbol(X, Decl(mutuallyRecursiveInference.ts, 1, 37))

View File

@@ -0,0 +1,18 @@
=== tests/cases/compiler/mutuallyRecursiveInference.ts ===
interface T<A> { a: A }
>T : T<A>
>A : A
>a : A
>A : A
interface L<RT> extends T<RT['a']> {}
>L : L<RT>
>RT : RT
>T : T<A>
>RT : RT
interface X extends L<X> {}
>X : X
>L : L<RT>
>X : X

View File

@@ -0,0 +1,3 @@
interface T<A> { a: A }
interface L<RT> extends T<RT['a']> {}
interface X extends L<X> {}