8000 Add test and baseline · creatio/TypeScript@31c5fc7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 31c5fc7

Browse files
committed
Add test and baseline
1 parent aa3e8d1 commit 31c5fc7

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//// [invalidThisEmitInContextualObjectLiteral.ts]
2+
interface IDef {
3+
p1: (e:string) => void;
4+
p2: () => (n: number) => any;
5+
}
6+
7+
class TestController {
8+
public m(def: IDef) { }
9+
public p = this.m({
10+
p1: e => { },
11+
p2: () => { return vvvvvvvvv => this; },
12+
});
13+
}
14+
15+
16+
//// [invalidThisEmitInContextualObjectLiteral.js]
17+
var TestController = (function () {
18+
function TestController() {
19+
var _this = this;
20+
this.p = this.m({
21+
p1: function (e) { },
22+
p2: function () { return function (vvvvvvvvv) { return _this; }; }
23+
});
24+
}
25+
TestController.prototype.m = function (def) { };
26+
return TestController;
27+
}());
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts ===
2+
interface IDef {
3+
>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0))
4+
5+
p1: (e:string) => void;
6+
>p1 : Symbol(p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 16))
7+
>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 6))
8+
9+
p2: () => (n: number) => any;
10+
>p2 : Symbol(p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 24))
11+
>n : Symbol(n, Decl(invalidThisEmitInContextualObjectLiteral.ts, 2, 12))
12+
}
13+
14+
class TestController {
15+
>TestController : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))
16+
17+
public m(def: IDef) { }
18+
>m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
19+
>def : Symbol(def, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 10))
20+
>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0))
21+
22+
public p = this.m({
23+
>p : Symbol(p, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 24))
24+
>this.m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
25+
>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))
26+
>m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
27+
28+
p1: e => { },
29+
>p1 : Symbol(p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 7, 20))
30+
>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 5))
31+
32+
p2: () => { return vvvvvvvvv => this; },
33+
>p2 : Symbol(p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 15))
34+
>vvvvvvvvv : Symbol(vvvvvvvvv, Decl(invalidThisEmitInContextualObjectLiteral.ts, 9, 20))
35+
>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))
36+
37+
});
38+
}
39+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts ===
2+
interface IDef {
3+
>IDef : IDef
4+
5+
p1: (e:string) => void;
6+
>p1 : (e: string) => void
7+
>e : string
8+
9+
p2: () => (n: number) => any;
10+
>p2 : () => (n: number) => any
11+
>n : number
12+
}
13+
14+
class TestController {
15+
>TestController : TestController
16+
17+
public m(def: IDef) { }
18+
>m : (def: IDef) => void
19+
>def : IDef
20+
>IDef : IDef
21+
22+
public p = this.m({
23+
>p : void
24+
>this.m({ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, }) : void
25+
>this.m : (def: IDef) => void
26+
>this : this
27+
>m : (def: IDef) => void
28+
>{ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, } : { p1: (e: string) => void; p2: () => {}; }
29+
30+
p1: e => { },
31+
>p1 : (e: string) => void
32+
>e => { } : (e: string) => void
33+
>e : string
34+
35+
p2: () => { return vvvvvvvvv => this; },
36+
>p2 : () => {}
37+
>() => { return vvvvvvvvv => this; } : () => {}
38+
>vvvvvvvvv => this : (vvvvvvvvv: number) => this
39+
>vvvvvvvvv : number
40+
>this : this
41+
42+
});
43+
}
44+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
interface IDef {
2+
p1: (e:string) => void;
3+
p2: () => (n: number) => any;
4+
}
5+
6+
class TestController {
7+
public m(def: IDef) { }
8+
public p = this.m({
9+
p1: e => { },
10+
p2: () => { return vvvvvvvvv => this; },
11+
});
12+
}

0 commit comments

Comments
 (0)
0