mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 02:15:10 -05:00
Test:Mutually recursive types do not recur infinitely
This commit is contained in:
@@ -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> {}
|
||||
|
||||
7
tests/baselines/reference/mutuallyRecursiveInference.js
Normal file
7
tests/baselines/reference/mutuallyRecursiveInference.js
Normal 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]
|
||||
18
tests/baselines/reference/mutuallyRecursiveInference.symbols
Normal file
18
tests/baselines/reference/mutuallyRecursiveInference.symbols
Normal 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))
|
||||
|
||||
18
tests/baselines/reference/mutuallyRecursiveInference.types
Normal file
18
tests/baselines/reference/mutuallyRecursiveInference.types
Normal 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
|
||||
|
||||
3
tests/cases/compiler/mutuallyRecursiveInference.ts
Normal file
3
tests/cases/compiler/mutuallyRecursiveInference.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
interface T<A> { a: A }
|
||||
interface L<RT> extends T<RT['a']> {}
|
||||
interface X extends L<X> {}
|
||||
Reference in New Issue
Block a user