|
| 1 | +=== tests/cases/compiler/arrowFunctionWithThisParameter.ts === |
| 2 | +namespace CannotReferenceThisInHere { |
| 3 | +>CannotReferenceThisInHere : Symbol(CannotReferenceThisInHere, Decl(arrowFunctionWithThisParameter.ts, 0, 0)) |
| 4 | + |
| 5 | + let f1 = (this: number) => { |
| 6 | +>f1 : Symbol(f1, Decl(arrowFunctionWithThisParameter.ts, 1, 7)) |
| 7 | +>this : Symbol(this, Decl(arrowFunctionWithThisParameter.ts, 1, 14)) |
| 8 | + |
| 9 | + // Test that the erroneously specified "this" type is not being used. |
| 10 | + let that = this; |
| 11 | +>that : Symbol(that, Decl(arrowFunctionWithThisParameter.ts, 3, 11)) |
| 12 | + |
| 13 | + }; |
| 14 | + let f2 = <T>(this: number) => { |
| 15 | +>f2 : Symbol(f2, Decl(arrowFunctionWithThisParameter.ts, 5, 7)) |
| 16 | +>T : Symbol(T, Decl(arrowFunctionWithThisParameter.ts, 5, 14)) |
| 17 | +>this : Symbol(this, Decl(arrowFunctionWithThisParameter.ts, 5, 17)) |
| 18 | + |
| 19 | + let that = this; |
| 20 | +>that : Symbol(that, Decl(arrowFunctionWithThisParameter.ts, 6, 11)) |
| 21 | + |
| 22 | + }; |
| 23 | + let f3 = async (this: number) => { |
| 24 | +>f3 : Symbol(f3, Decl(arrowFunctionWithThisParameter.ts, 8, 7)) |
| 25 | +>this : Symbol(this, Decl(arrowFunctionWithThisParameter.ts, 8, 20)) |
| 26 | + |
| 27 | + let that = this; |
| 28 | +>that : Symbol(that, Decl(arrowFunctionWithThisParameter.ts, 9, 11)) |
| 29 | + |
| 30 | + }; |
| 31 | + let f4 = async <T>(this: number) => { |
| 32 | +>f4 : Symbol(f4, Decl(arrowFunctionWithThisParameter.ts, 11, 7)) |
| 33 | +>T : Symbol(T, Decl(arrowFunctionWithThisParameter.ts, 11, 20)) |
| 34 | +>this : Symbol(this, Decl(arrowFunctionWithThisParameter.ts, 11, 23)) |
| 35 | + |
| 36 | + let that = this; |
| 37 | +>that : Symbol(that, Decl(arrowFunctionWithThisParameter.ts, 12, 11)) |
| 38 | + |
| 39 | + }; |
| 40 | +} |
| 41 | + |
0 commit comments