1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
//// [collisionSuperAndParameter.ts]
class Foo {
a() {
var lamda = (_super: number) => { // No Error
return x => this; // New scope. So should inject new _this capture
}
}
b(_super: number) { // No Error
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
set c(_super: number) { // No error
}
}
class Foo2 extends Foo {
x() {
var lamda = (_super: number) => { // Error
return x => this; // New scope. So should inject new _this capture
}
}
y(_super: number) { // Error
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
set z(_super: number) { // Error
}
public prop3: {
doStuff: (_super: number) => void; // no error - no code gen
}
public prop4 = {
doStuff: (_super: number) => { // should be error
}
}
constructor(_super: number) { // should be error
super();
}
}
declare class Foo3 extends Foo {
x();
y(_super: number); // No error - no code gen
constructor(_super: number); // No error - no code gen
public prop2: {
doStuff: (_super: number) => void; // no error - no code gen
};
public _super: number; // No error
}
class Foo4 extends Foo {
constructor(_super: number); // no code gen - no error
constructor(_super: string);// no code gen - no error
constructor(_super: any) { // should be error
super();
}
y(_super: number); // no code gen - no error
y(_super: string); // no code gen - no error
y(_super: any) { // Error
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
}
//// [collisionSuperAndParameter.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Foo = /** @class */ (function () {
function Foo() {
}
Foo.prototype.a = function () {
var _this = this;
var lamda = function (_super) {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Foo.prototype.b = function (_super) {
var _this = this;
var lambda = function () {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Object.defineProperty(Foo.prototype, "c", {
set: function (_super) {
},
enumerable: true,
configurable: true
});
return Foo;
}());
var Foo2 = /** @class */ (function (_super_1) {
__extends(Foo2, _super_1);
function Foo2(_super) {
var _this = _super_1.call(this) || this;
_this.prop4 = {
doStuff: function (_super) {
}
};
return _this;
}
Foo2.prototype.x = function () {
var _this = this;
var lamda = function (_super) {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Foo2.prototype.y = function (_super) {
var _this = this;
var lambda = function () {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Object.defineProperty(Foo2.prototype, "z", {
set: function (_super) {
},
enumerable: true,
configurable: true
});
return Foo2;
}(Foo));
var Foo4 = /** @class */ (function (_super_1) {
__extends(Foo4, _super_1);
function Foo4(_super) {
return _super_1.call(this) || this;
}
Foo4.prototype.y = function (_super) {
var _this = this;
var lambda = function () {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
return Foo4;
}(Foo));
|