Skip to content

Commit abab1b5

Browse files
committed
Revert "fix lookup regression again (microsoft#26762)"
This reverts commit 038f665.
1 parent acc3502 commit abab1b5

11 files changed

+6
-46
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ namespace ts {
12131213
}
12141214
if (meaning & SymbolFlags.Value && result.flags & SymbolFlags.Variable) {
12151215
// expression inside parameter will lookup as normal variable scope when targeting es2015+
1216-
if (compilerOptions.target && compilerOptions.target >= ScriptTarget.ES2015 && isParameter(lastLocation) && !isParameterPropertyDeclaration(lastLocation) && result.valueDeclaration.pos > lastLocation.end) {
1216+
if (compilerOptions.target && compilerOptions.target >= ScriptTarget.ES2015 && isParameter(lastLocation) && !isParameterPropertyDeclaration(lastLocation) && result.valueDeclaration !== lastLocation) {
12171217
useResult = false;
12181218
}
12191219
else if (result.flags & SymbolFlags.FunctionScopedVariable) {

tests/baselines/reference/parameterInitializersForwardReferencing1.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,4 @@ tests/cases/conformance/functions/parameterInitializersForwardReferencing1.ts(29
5555
class Foo {
5656
constructor(public x = 12, public y = x) {}
5757
}
58-
59-
function f8(foo1: string, bar = foo1) { }
6058

tests/baselines/reference/parameterInitializersForwardReferencing1.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ function f7({[foo]: bar}: any[]) {
3434
class Foo {
3535
constructor(public x = 12, public y = x) {}
3636
}
37-
38-
function f8(foo1: string, bar = foo1) { }
3937

4038

4139
//// [parameterInitializersForwardReferencing1.js]
@@ -83,6 +81,3 @@ var Foo = /** @class */ (function () {
8381
}
8482
return Foo;
8583
}());
86-
function f8(foo1, bar) {
87-
if (bar === void 0) { bar = foo1; }
88-
}

tests/baselines/reference/parameterInitializersForwardReferencing1.symbols

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,3 @@ class Foo {
8484
>x : Symbol(x, Decl(parameterInitializersForwardReferencing1.ts, 33, 16))
8585
}
8686

87-
function f8(foo1: string, bar = foo1) { }
88-
>f8 : Symbol(f8, Decl(parameterInitializersForwardReferencing1.ts, 34, 1))
89-
>foo1 : Symbol(foo1, Decl(parameterInitializersForwardReferencing1.ts, 36, 12))
90-
>bar : Symbol(bar, Decl(parameterInitializersForwardReferencing1.ts, 36, 25))
91-
>foo1 : Symbol(foo1, Decl(parameterInitializersForwardReferencing1.ts, 36, 12))
92-

tests/baselines/reference/parameterInitializersForwardReferencing1.types

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,3 @@ class Foo {
9292
>x : number
9393
}
9494

95-
function f8(foo1: string, bar = foo1) { }
96-
>f8 : (foo1: string, bar?: string) => void
97-
>foo1 : string
98-
>bar : string
99-
>foo1 : string
100-

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,4 @@ tests/cases/conformance/functions/parameterInitializersForwardReferencing1_es6.t
4242
class Foo {
4343
constructor(public x = 12, public y = x) {}
4444
}
45-
46-
function f8(foo1: string, bar = foo1) { }
4745

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ function f7({[foo]: bar}: any[]) {
3434
class Foo {
3535
constructor(public x = 12, public y = x) {}
3636
}
37-
38-
function f8(foo1: string, bar = foo1) { }
3937

4038

4139
//// [parameterInitializersForwardReferencing1_es6.js]
@@ -69,4 +67,3 @@ class Foo {
6967
this.y = y;
7068
}
7169
}
72-
function f8(foo1, bar = foo1) { }

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.symbols

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function f4 (foo, bar = foo) {
4242
>f4 : Symbol(f4, Decl(parameterInitializersForwardReferencing1_es6.ts, 14, 1))
4343
>foo : Symbol(foo, Decl(parameterInitializersForwardReferencing1_es6.ts, 16, 13))
4444
>bar : Symbol(bar, Decl(parameterInitializersForwardReferencing1_es6.ts, 16, 17))
45-
>foo : Symbol(foo, Decl(parameterInitializersForwardReferencing1_es6.ts, 16, 13))
45+
>foo : Symbol(foo, Decl(parameterInitializersForwardReferencing1_es6.ts, 0, 3))
4646

4747
return bar
4848
>bar : Symbol(bar, Decl(parameterInitializersForwardReferencing1_es6.ts, 16, 17))
@@ -84,9 +84,3 @@ class Foo {
8484
>x : Symbol(x, Decl(parameterInitializersForwardReferencing1_es6.ts, 33, 16))
8585
}
8686

87-
function f8(foo1: string, bar = foo1) { }
88-
>f8 : Symbol(f8, Decl(parameterInitializersForwardReferencing1_es6.ts, 34, 1))
89-
>foo1 : Symbol(foo1, Decl(parameterInitializersForwardReferencing1_es6.ts, 36, 12))
90-
>bar : Symbol(bar, Decl(parameterInitializersForwardReferencing1_es6.ts, 36, 25))
91-
>foo1 : Symbol(foo1, Decl(parameterInitializersForwardReferencing1_es6.ts, 36, 12))
92-

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.types

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ function f3 (bar = foo, foo = 2) { // correct compiler error, error at runtime
4545
}
4646

4747
function f4 (foo, bar = foo) {
48-
>f4 : (foo: any, bar?: any) => any
49-
>foo : any
50-
>bar : any
48+
>f4 : (foo: any, bar?: string) => string
5149
>foo : any
50+
>bar : string
51+
>foo : string
5252

5353
return bar
54-
>bar : any
54+
>bar : string
5555
}
5656

5757
function f5 (a = a) {
@@ -92,9 +92,3 @@ class Foo {
9292
>x : number
9393
}
9494

95-
function f8(foo1: string, bar = foo1) { }
96-
>f8 : (foo1: string, bar?: string) => void
97-
>foo1 : string
98-
>bar : string
99-
>foo1 : string
100-

tests/cases/conformance/functions/parameterInitializersForwardReferencing1.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,3 @@ function f7({[foo]: bar}: any[]) {
3333
class Foo {
3434
constructor(public x = 12, public y = x) {}
3535
}
36-
37-
function f8(foo1: string, bar = foo1) { }

0 commit comments

Comments
 (0)