Skip to content

Commit cbbc5e3

Browse files
committed
Revert "add test case and fix regression (microsoft#26726)"
This reverts commit f67d7e0.
1 parent abab1b5 commit cbbc5e3

11 files changed

+2
-79
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,8 @@ namespace ts {
12121212
: false;
12131213
}
12141214
if (meaning & SymbolFlags.Value && result.flags & SymbolFlags.Variable) {
1215-
// 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 !== lastLocation) {
1215+
// parameter initializer will lookup as normal variable scope when targeting es2015+
1216+
if (compilerOptions.target && compilerOptions.target >= ScriptTarget.ES2015 && isParameter(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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,4 @@ tests/cases/conformance/functions/parameterInitializersForwardReferencing1.ts(29
5151
!!! related TS2728 tests/cases/conformance/functions/parameterInitializersForwardReferencing1.ts:30:9: 'foo' is declared here.
5252
let foo: number = 2;
5353
}
54-
55-
class Foo {
56-
constructor(public x = 12, public y = x) {}
57-
}
5854

tests/baselines/reference/parameterInitializersForwardReferencing1.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ function f6 (async = async) {
3030
function f7({[foo]: bar}: any[]) {
3131
let foo: number = 2;
3232
}
33-
34-
class Foo {
35-
constructor(public x = 12, public y = x) {}
36-
}
3733

3834

3935
//// [parameterInitializersForwardReferencing1.js]
@@ -72,12 +68,3 @@ function f7(_a) {
7268
var _b = foo, bar = _a[_b];
7369
var foo = 2;
7470
}
75-
var Foo = /** @class */ (function () {
76-
function Foo(x, y) {
77-
if (x === void 0) { x = 12; }
78-
if (y === void 0) { y = x; }
79-
this.x = x;
80-
this.y = y;
81-
}
82-
return Foo;
83-
}());

tests/baselines/reference/parameterInitializersForwardReferencing1.symbols

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,3 @@ function f7({[foo]: bar}: any[]) {
7575
>foo : Symbol(foo, Decl(parameterInitializersForwardReferencing1.ts, 29, 7))
7676
}
7777

78-
class Foo {
79-
>Foo : Symbol(Foo, Decl(parameterInitializersForwardReferencing1.ts, 30, 1))
80-
81-
constructor(public x = 12, public y = x) {}
82-
>x : Symbol(Foo.x, Decl(parameterInitializersForwardReferencing1.ts, 33, 16))
83-
>y : Symbol(Foo.y, Decl(parameterInitializersForwardReferencing1.ts, 33, 30))
84-
>x : Symbol(x, Decl(parameterInitializersForwardReferencing1.ts, 33, 16))
85-
}
86-

tests/baselines/reference/parameterInitializersForwardReferencing1.types

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,3 @@ function f7({[foo]: bar}: any[]) {
8282
>2 : 2
8383
}
8484

85-
class Foo {
86-
>Foo : Foo
87-
88-
constructor(public x = 12, public y = x) {}
89-
>x : number
90-
>12 : 12
91-
>y : number
92-
>x : number
93-
}
94-

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.errors.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,4 @@ tests/cases/conformance/functions/parameterInitializersForwardReferencing1_es6.t
3838
function f7({[foo]: bar}: any[]) {
3939
let foo: number = 2;
4040
}
41-
42-
class Foo {
43-
constructor(public x = 12, public y = x) {}
44-
}
4541

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ function f6 (async = async) {
3030
function f7({[foo]: bar}: any[]) {
3131
let foo: number = 2;
3232
}
33-
34-
class Foo {
35-
constructor(public x = 12, public y = x) {}
36-
}
3733

3834

3935
//// [parameterInitializersForwardReferencing1_es6.js]
@@ -61,9 +57,3 @@ function f6(async = async) {
6157
function f7({ [foo]: bar }) {
6258
let foo = 2;
6359
}
64-
class Foo {
65-
constructor(x = 12, y = x) {
66-
this.x = x;
67-
this.y = y;
68-
}
69-
}

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.symbols

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,3 @@ function f7({[foo]: bar}: any[]) {
7575
>foo : Symbol(foo, Decl(parameterInitializersForwardReferencing1_es6.ts, 29, 7))
7676
}
7777

78-
class Foo {
79-
>Foo : Symbol(Foo, Decl(parameterInitializersForwardReferencing1_es6.ts, 30, 1))
80-
81-
constructor(public x = 12, public y = x) {}
82-
>x : Symbol(Foo.x, Decl(parameterInitializersForwardReferencing1_es6.ts, 33, 16))
83-
>y : Symbol(Foo.y, Decl(parameterInitializersForwardReferencing1_es6.ts, 33, 30))
84-
>x : Symbol(x, Decl(parameterInitializersForwardReferencing1_es6.ts, 33, 16))
85-
}
86-

tests/baselines/reference/parameterInitializersForwardReferencing1_es6.types

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,3 @@ function f7({[foo]: bar}: any[]) {
8282
>2 : 2
8383
}
8484

85-
class Foo {
86-
>Foo : Foo
87-
88-
constructor(public x = 12, public y = x) {}
89-
>x : number
90-
>12 : 12
91-
>y : number
92-
>x : number
93-
}
94-

tests/cases/conformance/functions/parameterInitializersForwardReferencing1.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,3 @@ function f6 (async = async) {
2929
function f7({[foo]: bar}: any[]) {
3030
let foo: number = 2;
3131
}
32-
33-
class Foo {
34-
constructor(public x = 12, public y = x) {}
35-
}

tests/cases/conformance/functions/parameterInitializersForwardReferencing1_es6.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,3 @@ function f6 (async = async) {
3131
function f7({[foo]: bar}: any[]) {
3232
let foo: number = 2;
3333
}
34-
35-
class Foo {
36-
constructor(public x = 12, public y = x) {}
37-
}

0 commit comments

Comments
 (0)