Adding regression test

This commit is contained in:
Anders Hejlsberg
2015-12-10 16:19:02 -08:00
parent 7fe811e6b2
commit 2e5a4ea983
4 changed files with 116 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
//// [circularObjectLiteralAccessors.ts]
// Repro from #6000
const a = {
b: {
get foo(): string {
return a.foo;
},
set foo(value: string) {
a.foo = value;
}
},
foo: ''
};
//// [circularObjectLiteralAccessors.js]
// Repro from #6000
var a = {
b: {
get foo() {
return a.foo;
},
set foo(value) {
a.foo = value;
}
},
foo: ''
};

View File

@@ -0,0 +1,34 @@
=== tests/cases/compiler/circularObjectLiteralAccessors.ts ===
// Repro from #6000
const a = {
>a : Symbol(a, Decl(circularObjectLiteralAccessors.ts, 3, 5))
b: {
>b : Symbol(b, Decl(circularObjectLiteralAccessors.ts, 3, 11))
get foo(): string {
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 4, 8), Decl(circularObjectLiteralAccessors.ts, 7, 10))
return a.foo;
>a.foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
>a : Symbol(a, Decl(circularObjectLiteralAccessors.ts, 3, 5))
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
},
set foo(value: string) {
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 4, 8), Decl(circularObjectLiteralAccessors.ts, 7, 10))
>value : Symbol(value, Decl(circularObjectLiteralAccessors.ts, 8, 16))
a.foo = value;
>a.foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
>a : Symbol(a, Decl(circularObjectLiteralAccessors.ts, 3, 5))
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
>value : Symbol(value, Decl(circularObjectLiteralAccessors.ts, 8, 16))
}
},
foo: ''
>foo : Symbol(foo, Decl(circularObjectLiteralAccessors.ts, 11, 6))
};

View File

@@ -0,0 +1,38 @@
=== tests/cases/compiler/circularObjectLiteralAccessors.ts ===
// Repro from #6000
const a = {
>a : { b: { foo: string; }; foo: string; }
>{ b: { get foo(): string { return a.foo; }, set foo(value: string) { a.foo = value; } }, foo: ''} : { b: { foo: string; }; foo: string; }
b: {
>b : { foo: string; }
>{ get foo(): string { return a.foo; }, set foo(value: string) { a.foo = value; } } : { foo: string; }
get foo(): string {
>foo : string
return a.foo;
>a.foo : string
>a : { b: { foo: string; }; foo: string; }
>foo : string
},
set foo(value: string) {
>foo : string
>value : string
a.foo = value;
>a.foo = value : string
>a.foo : string
>a : { b: { foo: string; }; foo: string; }
>foo : string
>value : string
}
},
foo: ''
>foo : string
>'' : string
};

View File

@@ -0,0 +1,15 @@
// @target: es5
// Repro from #6000
const a = {
b: {
get foo(): string {
return a.foo;
},
set foo(value: string) {
a.foo = value;
}
},
foo: ''
};