2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(2,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
|
|
|
tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(10,25): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
|
|
|
tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(20,17): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
|
|
|
tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts(30,25): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
|
|
|
|
|
|
|
|
2014-07-19 01:13:21 +02:00
|
|
|
==== tests/cases/compiler/collisionThisExpressionAndPropertyNameAsConstuctorParameter.ts (4 errors) ====
|
|
|
|
class Foo2 {
|
|
|
|
constructor(_this: number) { //Error
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
2014-07-19 01:13:21 +02:00
|
|
|
var lambda = () => {
|
|
|
|
return x => this; // New scope. So should inject new _this capture
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Foo3 {
|
|
|
|
constructor(private _this: number) { // Error
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
2014-07-19 01:13:21 +02:00
|
|
|
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
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
2014-07-19 01:13:21 +02:00
|
|
|
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
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.
|
2014-07-19 01:13:21 +02:00
|
|
|
var lambda = () => {
|
|
|
|
return x => this; // New scope. So should inject new _this capture
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|