Skip to content

Commit

Permalink
Add test and baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Feb 25, 2016
1 parent 3951821 commit 2115b37
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//// [invalidThisEmitInContextualObjectLiteral.ts]
interface IDef {
p1: (e:string) => void;
p2: () => (n: number) => any;
}

class TestController {
public m(def: IDef) { }
public p = this.m({
p1: e => { },
p2: () => { return vvvvvvvvv => this; },
});
}


//// [invalidThisEmitInContextualObjectLiteral.js]
var TestController = (function () {
function TestController() {
var _this = this;
this.p = this.m({
p1: function (e) { },
p2: function () { return function (vvvvvvvvv) { return _this; }; }
});
}
TestController.prototype.m = function (def) { };
return TestController;
}());
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts ===
interface IDef {
>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0))

p1: (e:string) => void;
>p1 : Symbol(p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 16))
>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 6))

p2: () => (n: number) => any;
>p2 : Symbol(p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 1, 24))
>n : Symbol(n, Decl(invalidThisEmitInContextualObjectLiteral.ts, 2, 12))
}

class TestController {
>TestController : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))

public m(def: IDef) { }
>m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
>def : Symbol(def, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 10))
>IDef : Symbol(IDef, Decl(invalidThisEmitInContextualObjectLiteral.ts, 0, 0))

public p = this.m({
>p : Symbol(p, Decl(invalidThisEmitInContextualObjectLiteral.ts, 6, 24))
>this.m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))
>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))
>m : Symbol(m, Decl(invalidThisEmitInContextualObjectLiteral.ts, 5, 22))

p1: e => { },
>p1 : Symbol(p1, Decl(invalidThisEmitInContextualObjectLiteral.ts, 7, 20))
>e : Symbol(e, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 5))

p2: () => { return vvvvvvvvv => this; },
>p2 : Symbol(p2, Decl(invalidThisEmitInContextualObjectLiteral.ts, 8, 15))
>vvvvvvvvv : Symbol(vvvvvvvvv, Decl(invalidThisEmitInContextualObjectLiteral.ts, 9, 20))
>this : Symbol(TestController, Decl(invalidThisEmitInContextualObjectLiteral.ts, 3, 1))

});
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
=== tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts ===
interface IDef {
>IDef : IDef

p1: (e:string) => void;
>p1 : (e: string) => void
>e : string

p2: () => (n: number) => any;
>p2 : () => (n: number) => any
>n : number
}

class TestController {
>TestController : TestController

public m(def: IDef) { }
>m : (def: IDef) => void
>def : IDef
>IDef : IDef

public p = this.m({
>p : void
>this.m({ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, }) : void
>this.m : (def: IDef) => void
>this : this
>m : (def: IDef) => void
>{ p1: e => { }, p2: () => { return vvvvvvvvv => this; }, } : { p1: (e: string) => void; p2: () => {}; }

p1: e => { },
>p1 : (e: string) => void
>e => { } : (e: string) => void
>e : string

p2: () => { return vvvvvvvvv => this; },
>p2 : () => {}
>() => { return vvvvvvvvv => this; } : () => {}
>vvvvvvvvv => this : (vvvvvvvvv: number) => this
>vvvvvvvvv : number
>this : this

});
}

12 changes: 12 additions & 0 deletions tests/cases/compiler/invalidThisEmitInContextualObjectLiteral.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
interface IDef {
p1: (e:string) => void;
p2: () => (n: number) => any;
}

class TestController {
public m(def: IDef) { }
public p = this.m({
p1: e => { },
p2: () => { return vvvvvvvvv => this; },
});
}

0 comments on commit 2115b37

Please sign in to comment.