Skip to content

Commit ae9d93b

Browse files
committed
Adding test
1 parent e6259a5 commit ae9d93b

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//// [recursiveUnionTypeInference.ts]
2+
interface Foo<T> {
3+
x: T;
4+
}
5+
6+
function bar<T>(x: Foo<T> | string): T {
7+
return bar(x);
8+
}
9+
10+
11+
//// [recursiveUnionTypeInference.js]
12+
function bar(x) {
13+
return bar(x);
14+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
=== tests/cases/compiler/recursiveUnionTypeInference.ts ===
2+
interface Foo<T> {
3+
>Foo : Symbol(Foo, Decl(recursiveUnionTypeInference.ts, 0, 0))
4+
>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 0, 14))
5+
6+
x: T;
7+
>x : Symbol(x, Decl(recursiveUnionTypeInference.ts, 0, 18))
8+
>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 0, 14))
9+
}
10+
11+
function bar<T>(x: Foo<T> | string): T {
12+
>bar : Symbol(bar, Decl(recursiveUnionTypeInference.ts, 2, 1))
13+
>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 4, 13))
14+
>x : Symbol(x, Decl(recursiveUnionTypeInference.ts, 4, 16))
15+
>Foo : Symbol(Foo, Decl(recursiveUnionTypeInference.ts, 0, 0))
16+
>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 4, 13))
17+
>T : Symbol(T, Decl(recursiveUnionTypeInference.ts, 4, 13))
18+
19+
return bar(x);
20+
>bar : Symbol(bar, Decl(recursiveUnionTypeInference.ts, 2, 1))
21+
>x : Symbol(x, Decl(recursiveUnionTypeInference.ts, 4, 16))
22+
}
23+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
=== tests/cases/compiler/recursiveUnionTypeInference.ts ===
2+
interface Foo<T> {
3+
>Foo : Foo<T>
4+
>T : T
5+
6+
x: T;
7+
>x : T
8+
>T : T
9+
}
10+
11+
function bar<T>(x: Foo<T> | string): T {
12+
>bar : <T>(x: Foo<T> | string) => T
13+
>T : T
14+
>x : Foo<T> | string
15+
>Foo : Foo<T>
16+
>T : T
17+
>T : T
18+
19+
return bar(x);
20+
>bar(x) : T
21+
>bar : <T>(x: Foo<T> | string) => T
22+
>x : Foo<T> | string
23+
}
24+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
interface Foo<T> {
2+
x: T;
3+
}
4+
5+
function bar<T>(x: Foo<T> | string): T {
6+
return bar(x);
7+
}

0 commit comments

Comments
 (0)