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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
=== tests/cases/compiler/collisionSuperAndParameter.ts ===
class Foo {
>Foo : Foo
a() {
>a : () => void
var lamda = (_super: number) => { // No Error
>lamda : (_super: number) => (x: any) => this
>(_super: number) => { // No Error return x => this; // New scope. So should inject new _this capture } : (_super: number) => (x: any) => this
>_super : number
return x => this; // New scope. So should inject new _this capture
>x => this : (x: any) => this
>x : any
>this : this
}
}
b(_super: number) { // No Error
>b : (_super: number) => void
>_super : number
var lambda = () => {
>lambda : () => (x: any) => this
>() => { return x => this; // New scope. So should inject new _this capture } : () => (x: any) => this
return x => this; // New scope. So should inject new _this capture
>x => this : (x: any) => this
>x : any
>this : this
}
}
set c(_super: number) { // No error
>c : number
>_super : number
}
}
class Foo2 extends Foo {
>Foo2 : Foo2
>Foo : Foo
x() {
>x : () => void
var lamda = (_super: number) => { // Error
>lamda : (_super: number) => (x: any) => this
>(_super: number) => { // Error return x => this; // New scope. So should inject new _this capture } : (_super: number) => (x: any) => this
>_super : number
return x => this; // New scope. So should inject new _this capture
>x => this : (x: any) => this
>x : any
>this : this
}
}
y(_super: number) { // Error
>y : (_super: number) => void
>_super : number
var lambda = () => {
>lambda : () => (x: any) => this
>() => { return x => this; // New scope. So should inject new _this capture } : () => (x: any) => this
return x => this; // New scope. So should inject new _this capture
>x => this : (x: any) => this
>x : any
>this : this
}
}
set z(_super: number) { // Error
>z : number
>_super : number
}
public prop3: {
>prop3 : { doStuff: (_super: number) => void; }
doStuff: (_super: number) => void; // no error - no code gen
>doStuff : (_super: number) => void
>_super : number
}
public prop4 = {
>prop4 : { doStuff: (_super: number) => void; }
>{ doStuff: (_super: number) => { // should be error } } : { doStuff: (_super: number) => void; }
doStuff: (_super: number) => { // should be error
>doStuff : (_super: number) => void
>(_super: number) => { // should be error } : (_super: number) => void
>_super : number
}
}
constructor(_super: number) { // should be error
>_super : number
super();
>super() : void
>super : typeof Foo
}
}
declare class Foo3 extends Foo {
>Foo3 : Foo3
>Foo : Foo
x();
>x : () => any
y(_super: number); // No error - no code gen
>y : (_super: number) => any
>_super : number
constructor(_super: number); // No error - no code gen
>_super : number
public prop2: {
>prop2 : { doStuff: (_super: number) => void; }
doStuff: (_super: number) => void; // no error - no code gen
>doStuff : (_super: number) => void
>_super : number
};
public _super: number; // No error
>_super : number
}
class Foo4 extends Foo {
>Foo4 : Foo4
>Foo : Foo
constructor(_super: number); // no code gen - no error
>_super : number
constructor(_super: string);// no code gen - no error
>_super : string
constructor(_super: any) { // should be error
>_super : any
super();
>super() : void
>super : typeof Foo
}
y(_super: number); // no code gen - no error
>y : { (_super: number): any; (_super: string): any; }
>_super : number
y(_super: string); // no code gen - no error
>y : { (_super: number): any; (_super: string): any; }
>_super : string
y(_super: any) { // Error
>y : { (_super: number): any; (_super: string): any; }
>_super : any
var lambda = () => {
>lambda : () => (x: any) => this
>() => { return x => this; // New scope. So should inject new _this capture } : () => (x: any) => this
return x => this; // New scope. So should inject new _this capture
>x => this : (x: any) => this
>x : any
>this : this
}
}
}
|