TypeScript/tests/baselines/reference/collisionThisExpressionAndPropertyNameAsConstuctorParameter.errors.txt
2014-07-18 16:16:28 -07:00

44 lines
1.8 KiB
Plaintext

==== tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts (4 errors) ====
class Foo2 {
constructor(_this: number) { //Error
~~~~~
!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
}
class Foo3 {
constructor(private _this: number) { // Error
~~~~~
!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
}
class Foo4 {
constructor(_this: number); // No code gen - no error
constructor(_this: string); // No code gen - no error
constructor(_this: any) { // Error
~~~~~
!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
}
class Foo5 {
constructor(_this: number); // No code gen - no error
constructor(_this: string); // No code gen - no error
constructor(private _this: any) { // Error
~~~~~
!!! Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
}