Skip to content

Commit 2e5a4ea

Browse files
committed
Adding regression test
1 parent 7fe811e commit 2e5a4ea

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//// [circularObjectLiteralAccessors.ts]
2+
3+
// Repro from #6000
4+
5+
const a = {
6+
b: {
7+
get foo(): string {
8+
return a.foo;
9+
},
10+
set foo(value: string) {
11+
a.foo = value;
12+
}
13+
},
14+
foo: ''
15+
};
16+
17+
//// [circularObjectLiteralAccessors.js]
18+
// Repro from #6000
19+
var a = {
20+
b: {
21+
get foo() {
22+
return a.foo;
23+
},
24+
set foo(value) {
25+
a.foo = value;
26+
}
27+
},
28+
foo: ''
29+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
=== tests/cases/compiler/circularObjectLiteralAccessors.ts ===
2+
3+
// Repro from #6000
4+
5+
const a = {
6+
>a : Symbol(a, Decl(circularObjectLiteralAccessors.ts, 3, 5))
7+
8+
b: {
9+
>b : Symbol(b, Decl(circularObjectLiteralAccessors.ts, 3, 11))
10+
11+
get foo(): string {
12+
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 4, 8), Decl(circularObjectLiteralAccessors.ts, 7, 10))
13+
14+
return a.foo;
15+
>a.foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
16+
>a : Symbol(a, Decl(circularObjectLiteralAccessors.ts, 3, 5))
17+
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
18+
19+
},
20+
set foo(value: string) {
21+
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 4, 8), Decl(circularObjectLiteralAccessors.ts, 7, 10))
22+
>value : Symbol(value, Decl(circularObjectLiteralAccessors.ts, 8, 16))
23+
24+
a.foo = value;
25+
>a.foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
26+
>a : Symbol(a, Decl(circularObjectLiteralAccessors.ts, 3, 5))
27+
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
28+
>value : Symbol(value, Decl(circularObjectLiteralAccessors.ts, 8, 16))
29+
}
30+
},
31+
foo: ''
32+
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
33+
34+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
=== tests/cases/compiler/circularObjectLiteralAccessors.ts ===
2+
3+
// Repro from #6000
4+
5+
const a = {
6+
>a : { b: { foo: string; }; foo: string; }
7+
>{ b: { get foo(): string { return a.foo; }, set foo(value: string) { a.foo = value; } }, foo: ''} : { b: { foo: string; }; foo: string; }
8+
9+
b: {
10+
>b : { foo: string; }
11+
>{ get foo(): string { return a.foo; }, set foo(value: string) { a.foo = value; } } : { foo: string; }
12+
13+
get foo(): string {
14+
>foo : string
15+
16+
return a.foo;
17+
>a.foo : string
18+
>a : { b: { foo: string; }; foo: string; }
19+
>foo : string
20+
21+
},
22+
set foo(value: string) {
23+
>foo : string
24+
>value : string
25+
26+
a.foo = value;
27+
>a.foo = value : string
28+
>a.foo : string
29+
>a : { b: { foo: string; }; foo: string; }
30+
>foo : string
31+
>value : string
32+
}
33+
},
34+
foo: ''
35+
>foo : string
36+
>'' : string
37+
38+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @target: es5
2+
3+
// Repro from #6000
4+
5+
const a = {
6+
b: {
7+
get foo(): string {
8+
return a.foo;
9+
},
10+
set foo(value: string) {
11+
a.foo = value;
12+
}
13+
},
14+
foo: ''
15+
};

0 commit comments

Comments
 (0)