Skip to content

Commit d1393a6

Browse files
committed
Add regression test
1 parent f2c32d2 commit d1393a6

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//// [mappedTypeInferenceCircularity.ts]
2+
// Repro from #12511
3+
4+
type HTML = { [K in 'div']: Block<HTML> };
5+
type Block<P> = <T>(func: HTML) => {};
6+
7+
declare var h: HTML;
8+
h.div(h);
9+
10+
//// [mappedTypeInferenceCircularity.js]
11+
// Repro from #12511
12+
h.div(h);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/compiler/mappedTypeInferenceCircularity.ts ===
2+
// Repro from #12511
3+
4+
type HTML = { [K in 'div']: Block<HTML> };
5+
>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0))
6+
>K : Symbol(K, Decl(mappedTypeInferenceCircularity.ts, 2, 15))
7+
>Block : Symbol(Block, Decl(mappedTypeInferenceCircularity.ts, 2, 42))
8+
>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0))
9+
10+
type Block<P> = <T>(func: HTML) => {};
11+
>Block : Symbol(Block, Decl(mappedTypeInferenceCircularity.ts, 2, 42))
12+
>P : Symbol(P, Decl(mappedTypeInferenceCircularity.ts, 3, 11))
13+
>T : Symbol(T, Decl(mappedTypeInferenceCircularity.ts, 3, 17))
14+
>func : Symbol(func, Decl(mappedTypeInferenceCircularity.ts, 3, 20))
15+
>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0))
16+
17+
declare var h: HTML;
18+
>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11))
19+
>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0))
20+
21+
h.div(h);
22+
>h.div : Symbol(div)
23+
>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11))
24+
>div : Symbol(div)
25+
>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11))
26+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
=== tests/cases/compiler/mappedTypeInferenceCircularity.ts ===
2+
// Repro from #12511
3+
4+
type HTML = { [K in 'div']: Block<HTML> };
5+
>HTML : HTML
6+
>K : K
7+
>Block : Block<P>
8+
>HTML : HTML
9+
10+
type Block<P> = <T>(func: HTML) => {};
11+
>Block : Block<P>
12+
>P : P
13+
>T : T
14+
>func : HTML
15+
>HTML : HTML
16+
17+
declare var h: HTML;
18+
>h : HTML
19+
>HTML : HTML
20+
21+
h.div(h);
22+
>h.div(h) : {}
23+
>h.div : Block<HTML>
24+
>h : HTML
25+
>div : Block<HTML>
26+
>h : HTML
27+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Repro from #12511
2+
3+
type HTML = { [K in 'div']: Block<HTML> };
4+
type Block<P> = <T>(func: HTML) => {};
5+
6+
declare var h: HTML;
7+
h.div(h);

0 commit comments

Comments
 (0)