From 699ea246ffbc03e3afb80f58476348daeb1cbe4c Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 20 Apr 2018 15:02:18 -0700 Subject: [PATCH] Skip arrow functions in checkAndReportErrorForMissingPrefix (#23584) --- src/compiler/checker.ts | 2 +- .../classMemberInitializerWithLamdaScoping4.errors.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c1cb7166015..f0d13cacf51 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1568,7 +1568,7 @@ namespace ts { return false; } - const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ true); + const container = getThisContainer(errorLocation, /*includeArrowFunctions*/ false); let location = container; while (location) { if (isClassLike(location.parent)) { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt index 58a660c1ee8..03aa27e91f8 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'? ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (0 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error T messageHandler = () => { console.log(field1); // Should be error that couldnt find symbol field1 ~~~~~~ -!!! error TS2304: Cannot find name 'field1'. +!!! error TS2663: Cannot find name 'field1'. Did you mean the instance member 'this.field1'? }; } \ No newline at end of file