Fix == typo and add object literal 'this' test
This commit is contained in:
parent
2a9f39b132
commit
921d5f83e9
|
@ -4252,7 +4252,7 @@ namespace ts {
|
|||
const resolvedSymbol = resolveName(param, paramSymbol.name, SymbolFlags.Value, undefined, undefined);
|
||||
paramSymbol = resolvedSymbol;
|
||||
}
|
||||
if (i == 0 && paramSymbol.name === "this") {
|
||||
if (i === 0 && paramSymbol.name === "this") {
|
||||
hasThisParameter = true;
|
||||
thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,29 @@ let o = {
|
|||
return this.d.length;
|
||||
}
|
||||
}
|
||||
let mutuallyRecursive = {
|
||||
a: 100,
|
||||
start() {
|
||||
return this.passthrough(this.a);
|
||||
},
|
||||
passthrough(n: number) {
|
||||
return this.sub1(n);
|
||||
},
|
||||
sub1(n: number): number {
|
||||
if (n > 0) {
|
||||
return this.passthrough(n - 1);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
var i: number = mutuallyRecursive.start();
|
||||
interface I {
|
||||
a: number;
|
||||
start(): number;
|
||||
passthrough(n: number): number;
|
||||
sub1(n: number): number;
|
||||
}
|
||||
var impl: I = mutuallyRecursive;
|
||||
|
||||
|
||||
//// [thisTypeInObjectLiterals.js]
|
||||
|
@ -14,3 +37,20 @@ var o = {
|
|||
return this.d.length;
|
||||
}
|
||||
};
|
||||
var mutuallyRecursive = {
|
||||
a: 100,
|
||||
start: function () {
|
||||
return this.passthrough(this.a);
|
||||
},
|
||||
passthrough: function (n) {
|
||||
return this.sub1(n);
|
||||
},
|
||||
sub1: function (n) {
|
||||
if (n > 0) {
|
||||
return this.passthrough(n - 1);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
};
|
||||
var i = mutuallyRecursive.start();
|
||||
var impl = mutuallyRecursive;
|
||||
|
|
|
@ -16,4 +16,77 @@ let o = {
|
|||
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
}
|
||||
let mutuallyRecursive = {
|
||||
>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 6, 3))
|
||||
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(thisTypeInObjectLiterals.ts, 6, 25))
|
||||
|
||||
start() {
|
||||
>start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 7, 11))
|
||||
|
||||
return this.passthrough(this.a);
|
||||
>this.passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6))
|
||||
>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23))
|
||||
>passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6))
|
||||
>this.a : Symbol(a, Decl(thisTypeInObjectLiterals.ts, 6, 25))
|
||||
>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23))
|
||||
>a : Symbol(a, Decl(thisTypeInObjectLiterals.ts, 6, 25))
|
||||
|
||||
},
|
||||
passthrough(n: number) {
|
||||
>passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6))
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 11, 16))
|
||||
|
||||
return this.sub1(n);
|
||||
>this.sub1 : Symbol(sub1, Decl(thisTypeInObjectLiterals.ts, 13, 6))
|
||||
>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23))
|
||||
>sub1 : Symbol(sub1, Decl(thisTypeInObjectLiterals.ts, 13, 6))
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 11, 16))
|
||||
|
||||
},
|
||||
sub1(n: number): number {
|
||||
>sub1 : Symbol(sub1, Decl(thisTypeInObjectLiterals.ts, 13, 6))
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9))
|
||||
|
||||
if (n > 0) {
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9))
|
||||
|
||||
return this.passthrough(n - 1);
|
||||
>this.passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6))
|
||||
>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23))
|
||||
>passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6))
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9))
|
||||
}
|
||||
return n;
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9))
|
||||
}
|
||||
}
|
||||
var i: number = mutuallyRecursive.start();
|
||||
>i : Symbol(i, Decl(thisTypeInObjectLiterals.ts, 21, 3))
|
||||
>mutuallyRecursive.start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 7, 11))
|
||||
>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 6, 3))
|
||||
>start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 7, 11))
|
||||
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(thisTypeInObjectLiterals.ts, 21, 42))
|
||||
|
||||
a: number;
|
||||
>a : Symbol(I.a, Decl(thisTypeInObjectLiterals.ts, 22, 13))
|
||||
|
||||
start(): number;
|
||||
>start : Symbol(I.start, Decl(thisTypeInObjectLiterals.ts, 23, 14))
|
||||
|
||||
passthrough(n: number): number;
|
||||
>passthrough : Symbol(I.passthrough, Decl(thisTypeInObjectLiterals.ts, 24, 20))
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 25, 16))
|
||||
|
||||
sub1(n: number): number;
|
||||
>sub1 : Symbol(I.sub1, Decl(thisTypeInObjectLiterals.ts, 25, 35))
|
||||
>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 26, 9))
|
||||
}
|
||||
var impl: I = mutuallyRecursive;
|
||||
>impl : Symbol(impl, Decl(thisTypeInObjectLiterals.ts, 28, 3))
|
||||
>I : Symbol(I, Decl(thisTypeInObjectLiterals.ts, 21, 42))
|
||||
>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 6, 3))
|
||||
|
||||
|
|
|
@ -18,4 +18,87 @@ let o = {
|
|||
>length : number
|
||||
}
|
||||
}
|
||||
let mutuallyRecursive = {
|
||||
>mutuallyRecursive : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
>{ a: 100, start() { return this.passthrough(this.a); }, passthrough(n: number) { return this.sub1(n); }, sub1(n: number): number { if (n > 0) { return this.passthrough(n - 1); } return n; }} : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : number
|
||||
|
||||
start() {
|
||||
>start : () => number
|
||||
|
||||
return this.passthrough(this.a);
|
||||
>this.passthrough(this.a) : number
|
||||
>this.passthrough : (n: number) => number
|
||||
>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
>passthrough : (n: number) => number
|
||||
>this.a : number
|
||||
>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
>a : number
|
||||
|
||||
},
|
||||
passthrough(n: number) {
|
||||
>passthrough : (n: number) => number
|
||||
>n : number
|
||||
|
||||
return this.sub1(n);
|
||||
>this.sub1(n) : number
|
||||
>this.sub1 : (n: number) => number
|
||||
>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
>sub1 : (n: number) => number
|
||||
>n : number
|
||||
|
||||
},
|
||||
sub1(n: number): number {
|
||||
>sub1 : (n: number) => number
|
||||
>n : number
|
||||
|
||||
if (n > 0) {
|
||||
>n > 0 : boolean
|
||||
>n : number
|
||||
>0 : number
|
||||
|
||||
return this.passthrough(n - 1);
|
||||
>this.passthrough(n - 1) : number
|
||||
>this.passthrough : (n: number) => number
|
||||
>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
>passthrough : (n: number) => number
|
||||
>n - 1 : number
|
||||
>n : number
|
||||
>1 : number
|
||||
}
|
||||
return n;
|
||||
>n : number
|
||||
}
|
||||
}
|
||||
var i: number = mutuallyRecursive.start();
|
||||
>i : number
|
||||
>mutuallyRecursive.start() : number
|
||||
>mutuallyRecursive.start : () => number
|
||||
>mutuallyRecursive : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
>start : () => number
|
||||
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
a: number;
|
||||
>a : number
|
||||
|
||||
start(): number;
|
||||
>start : () => number
|
||||
|
||||
passthrough(n: number): number;
|
||||
>passthrough : (n: number) => number
|
||||
>n : number
|
||||
|
||||
sub1(n: number): number;
|
||||
>sub1 : (n: number) => number
|
||||
>n : number
|
||||
}
|
||||
var impl: I = mutuallyRecursive;
|
||||
>impl : I
|
||||
>I : I
|
||||
>mutuallyRecursive : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; }
|
||||
|
||||
|
|
|
@ -4,3 +4,26 @@ let o = {
|
|||
return this.d.length;
|
||||
}
|
||||
}
|
||||
let mutuallyRecursive = {
|
||||
a: 100,
|
||||
start() {
|
||||
return this.passthrough(this.a);
|
||||
},
|
||||
passthrough(n: number) {
|
||||
return this.sub1(n);
|
||||
},
|
||||
sub1(n: number): number {
|
||||
if (n > 0) {
|
||||
return this.passthrough(n - 1);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
var i: number = mutuallyRecursive.start();
|
||||
interface I {
|
||||
a: number;
|
||||
start(): number;
|
||||
passthrough(n: number): number;
|
||||
sub1(n: number): number;
|
||||
}
|
||||
var impl: I = mutuallyRecursive;
|
||||
|
|
Loading…
Reference in a new issue