Skip to content

Commit 3926c50

Browse files
committed
Revert checker changes
1 parent 250ce85 commit 3926c50

File tree

80 files changed

+250
-248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+250
-248
lines changed

src/compiler/checker.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22813,12 +22813,22 @@ namespace ts {
2281322813
// We cannot answer semantic questions within a with block, do not proceed any further
2281422814
return undefined;
2281522815
}
22816-
22816+
22817+
if (isDeclarationNameOrImportPropertyName(node)) {
22818+
// This is a declaration, call getSymbolOfNode
22819+
return getSymbolOfNode(node.parent);
22820+
}
22821+
else if (isLiteralComputedPropertyDeclarationName(node)) {
22822+
return getSymbolOfNode(node.parent.parent);
22823+
}
22824+
2281722825
if (node.kind === SyntaxKind.Identifier) {
2281822826
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
2281922827
return getSymbolOfEntityNameOrPropertyAccessExpression(<Identifier>node);
2282022828
}
22821-
else if (node.parent.kind === SyntaxKind.BindingElement && node.parent.parent.kind === SyntaxKind.ObjectBindingPattern) {
22829+
else if (node.parent.kind === SyntaxKind.BindingElement &&
22830+
node.parent.parent.kind === SyntaxKind.ObjectBindingPattern &&
22831+
node === (<BindingElement>node.parent).propertyName) {
2282222832
const typeOfPattern = getTypeOfNode(node.parent.parent);
2282322833
const propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, (<Identifier>node).escapedText);
2282422834

@@ -22828,14 +22838,6 @@ namespace ts {
2282822838
}
2282922839
}
2283022840

22831-
if (isDeclarationNameOrImportPropertyName(node)) {
22832-
// This is a declaration, call getSymbolOfNode
22833-
return getSymbolOfNode(node.parent);
22834-
}
22835-
else if (isLiteralComputedPropertyDeclarationName(node)) {
22836-
return getSymbolOfNode(node.parent.parent);
22837-
}
22838-
2283922841
switch (node.kind) {
2284022842
case SyntaxKind.Identifier:
2284122843
case SyntaxKind.PropertyAccessExpression:

tests/baselines/reference/arrowFunctionExpressions.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,27 @@ var p5 = ([a = 1]) => { };
6666

6767
var p6 = ({ a }) => { };
6868
>p6 : Symbol(p6, Decl(arrowFunctionExpressions.ts, 20, 3))
69-
>a : Symbol(a)
69+
>a : Symbol(a, Decl(arrowFunctionExpressions.ts, 20, 11))
7070

7171
var p7 = ({ a: { b } }) => { };
7272
>p7 : Symbol(p7, Decl(arrowFunctionExpressions.ts, 21, 3))
7373
>a : Symbol(a)
74-
>b : Symbol(b)
74+
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 21, 16))
7575

7676
var p8 = ({ a = 1 }) => { };
7777
>p8 : Symbol(p8, Decl(arrowFunctionExpressions.ts, 22, 3))
78-
>a : Symbol(a)
78+
>a : Symbol(a, Decl(arrowFunctionExpressions.ts, 22, 11))
7979

8080
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
8181
>p9 : Symbol(p9, Decl(arrowFunctionExpressions.ts, 23, 3))
8282
>a : Symbol(a)
83-
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 23, 28))
83+
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 23, 16))
8484
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 23, 28))
8585

8686
var p10 = ([{ value, done }]) => { };
8787
>p10 : Symbol(p10, Decl(arrowFunctionExpressions.ts, 24, 3))
88-
>value : Symbol(value)
89-
>done : Symbol(done)
88+
>value : Symbol(value, Decl(arrowFunctionExpressions.ts, 24, 13))
89+
>done : Symbol(done, Decl(arrowFunctionExpressions.ts, 24, 20))
9090

9191
// Arrow function used in class member initializer
9292
// Arrow function used in class member function

tests/baselines/reference/capturedLetConstInLoop9.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function foo() {
8888
>b : Symbol(b, Decl(capturedLetConstInLoop9.ts, 47, 16))
8989

9090
var [{x, y:z}] = [{x:1, y:2}];
91-
>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 48, 31))
91+
>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 48, 18))
9292
>y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 48, 35))
9393
>z : Symbol(z, Decl(capturedLetConstInLoop9.ts, 48, 20))
9494
>x : Symbol(x, Decl(capturedLetConstInLoop9.ts, 48, 31))
@@ -121,7 +121,7 @@ function foo() {
121121
>b : Symbol(b, Decl(capturedLetConstInLoop9.ts, 66, 16))
122122

123123
var [{x1, y:z1}] = [{x1:1, y:arguments.length}];
124-
>x1 : Symbol(x1, Decl(capturedLetConstInLoop9.ts, 67, 33))
124+
>x1 : Symbol(x1, Decl(capturedLetConstInLoop9.ts, 67, 18))
125125
>y : Symbol(y, Decl(capturedLetConstInLoop9.ts, 67, 38))
126126
>z1 : Symbol(z1, Decl(capturedLetConstInLoop9.ts, 67, 21))
127127
>x1 : Symbol(x1, Decl(capturedLetConstInLoop9.ts, 67, 33))

tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function foo() {
8888
>b : Symbol(b, Decl(capturedLetConstInLoop9_ES6.ts, 47, 16))
8989

9090
var [{x, y:z}] = [{x:1, y:2}];
91-
>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 48, 31))
91+
>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 48, 18))
9292
>y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 48, 35))
9393
>z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 48, 20))
9494
>x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 48, 31))
@@ -121,7 +121,7 @@ function foo() {
121121
>b : Symbol(b, Decl(capturedLetConstInLoop9_ES6.ts, 66, 16))
122122

123123
var [{x1, y:z1}] = [{x1:1, y:arguments.length}];
124-
>x1 : Symbol(x1, Decl(capturedLetConstInLoop9_ES6.ts, 67, 33))
124+
>x1 : Symbol(x1, Decl(capturedLetConstInLoop9_ES6.ts, 67, 18))
125125
>y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 67, 38))
126126
>z1 : Symbol(z1, Decl(capturedLetConstInLoop9_ES6.ts, 67, 21))
127127
>x1 : Symbol(x1, Decl(capturedLetConstInLoop9_ES6.ts, 67, 33))

tests/baselines/reference/contextuallyTypedBindingInitializer.symbols

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface Show {
88
}
99
function f({ show = v => v.toString() }: Show) {}
1010
>f : Symbol(f, Decl(contextuallyTypedBindingInitializer.ts, 2, 1))
11-
>show : Symbol(Show.show, Decl(contextuallyTypedBindingInitializer.ts, 0, 16))
11+
>show : Symbol(show, Decl(contextuallyTypedBindingInitializer.ts, 3, 12))
1212
>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 3, 19))
1313
>v.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
1414
>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 3, 19))
@@ -43,7 +43,7 @@ interface Nested {
4343
}
4444
function ff({ nested = { show: v => v.toString() } }: Nested) {}
4545
>ff : Symbol(ff, Decl(contextuallyTypedBindingInitializer.ts, 9, 1))
46-
>nested : Symbol(Nested.nested, Decl(contextuallyTypedBindingInitializer.ts, 7, 18))
46+
>nested : Symbol(nested, Decl(contextuallyTypedBindingInitializer.ts, 10, 13))
4747
>show : Symbol(show, Decl(contextuallyTypedBindingInitializer.ts, 10, 24))
4848
>v : Symbol(v, Decl(contextuallyTypedBindingInitializer.ts, 10, 30))
4949
>v.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --))
@@ -59,7 +59,7 @@ interface Tuples {
5959
}
6060
function g({ prop = ["hello", 1234] }: Tuples) {}
6161
>g : Symbol(g, Decl(contextuallyTypedBindingInitializer.ts, 14, 1))
62-
>prop : Symbol(Tuples.prop, Decl(contextuallyTypedBindingInitializer.ts, 12, 18))
62+
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializer.ts, 15, 12))
6363
>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializer.ts, 10, 64))
6464

6565
interface StringUnion {
@@ -70,7 +70,7 @@ interface StringUnion {
7070
}
7171
function h({ prop = "foo" }: StringUnion) {}
7272
>h : Symbol(h, Decl(contextuallyTypedBindingInitializer.ts, 19, 1))
73-
>prop : Symbol(StringUnion.prop, Decl(contextuallyTypedBindingInitializer.ts, 17, 23))
73+
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializer.ts, 20, 12))
7474
>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializer.ts, 15, 49))
7575

7676
interface StringIdentity {

tests/baselines/reference/contextuallyTypedBindingInitializerNegative.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ interface Tuples {
7272
}
7373
function g({ prop = [101, 1234] }: Tuples) {}
7474
>g : Symbol(g, Decl(contextuallyTypedBindingInitializerNegative.ts, 19, 1))
75-
>prop : Symbol(Tuples.prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 17, 18))
75+
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 12))
7676
>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 91))
7777

7878
interface StringUnion {
@@ -83,6 +83,6 @@ interface StringUnion {
8383
}
8484
function h({ prop = "baz" }: StringUnion) {}
8585
>h : Symbol(h, Decl(contextuallyTypedBindingInitializerNegative.ts, 24, 1))
86-
>prop : Symbol(StringUnion.prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 22, 23))
86+
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 25, 12))
8787
>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 45))
8888

tests/baselines/reference/contextuallyTypedBindingInitializerNegative.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ interface Tuples {
8080
}
8181
function g({ prop = [101, 1234] }: Tuples) {}
8282
>g : ({ prop }: Tuples) => void
83-
>prop : [string, number]
83+
>prop : [string, number] | [number, number]
8484
>[101, 1234] : [number, number]
8585
>101 : 101
8686
>1234 : 1234
@@ -94,7 +94,7 @@ interface StringUnion {
9494
}
9595
function h({ prop = "baz" }: StringUnion) {}
9696
>h : ({ prop }: StringUnion) => void
97-
>prop : "foo" | "bar"
97+
>prop : "foo" | "bar" | "baz"
9898
>"baz" : "baz"
9999
>StringUnion : StringUnion
100100

tests/baselines/reference/contextuallyTypedIife.symbols

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,23 @@
8181

8282
// destructuring parameters (with defaults too!)
8383
(({ q }) => q)({ q : 13 });
84-
>q : Symbol(q, Decl(contextuallyTypedIife.ts, 22, 16))
84+
>q : Symbol(q, Decl(contextuallyTypedIife.ts, 22, 3))
8585
>q : Symbol(q, Decl(contextuallyTypedIife.ts, 22, 3))
8686
>q : Symbol(q, Decl(contextuallyTypedIife.ts, 22, 16))
8787

8888
(({ p = 14 }) => p)({ p : 15 });
89-
>p : Symbol(p, Decl(contextuallyTypedIife.ts, 23, 21))
89+
>p : Symbol(p, Decl(contextuallyTypedIife.ts, 23, 3))
9090
>p : Symbol(p, Decl(contextuallyTypedIife.ts, 23, 3))
9191
>p : Symbol(p, Decl(contextuallyTypedIife.ts, 23, 21))
9292

9393
(({ r = 17 } = { r: 18 }) => r)({r : 19});
94-
>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 33))
94+
>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 3))
9595
>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 16))
9696
>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 3))
9797
>r : Symbol(r, Decl(contextuallyTypedIife.ts, 24, 33))
9898

9999
(({ u = 22 } = { u: 23 }) => u)();
100-
>u : Symbol(u, Decl(contextuallyTypedIife.ts, 25, 16))
100+
>u : Symbol(u, Decl(contextuallyTypedIife.ts, 25, 3))
101101
>u : Symbol(u, Decl(contextuallyTypedIife.ts, 25, 16))
102102
>u : Symbol(u, Decl(contextuallyTypedIife.ts, 25, 3))
103103

tests/baselines/reference/controlFlowDestructuringDeclaration.symbols

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ function f4() {
6565
>f4 : Symbol(f4, Decl(controlFlowDestructuringDeclaration.ts, 23, 1))
6666

6767
let { x }: { x: string | number } = { x: 1 };
68-
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 26, 16))
68+
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 26, 9))
6969
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 26, 16))
7070
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 26, 41))
7171

7272
x;
7373
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 26, 9))
7474

7575
let { y }: { y: string | undefined } = { y: "" };
76-
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 28, 16))
76+
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 28, 9))
7777
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 28, 16))
7878
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 28, 44))
7979

8080
y;
8181
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 28, 9))
8282

8383
let { z = "" }: { z: string | undefined } = { z: undefined };
84-
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 30, 21))
84+
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 30, 9))
8585
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 30, 21))
8686
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 30, 49))
8787
>undefined : Symbol(undefined)
@@ -94,23 +94,23 @@ function f5() {
9494
>f5 : Symbol(f5, Decl(controlFlowDestructuringDeclaration.ts, 32, 1))
9595

9696
let { x }: { x?: string | number } = { x: 1 };
97-
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 35, 16))
97+
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 35, 9))
9898
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 35, 16))
9999
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 35, 42))
100100

101101
x;
102102
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 35, 9))
103103

104104
let { y }: { y?: string | undefined } = { y: "" };
105-
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 37, 16))
105+
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 37, 9))
106106
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 37, 16))
107107
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 37, 45))
108108

109109
y;
110110
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 37, 9))
111111

112112
let { z = "" }: { z?: string | undefined } = { z: undefined };
113-
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 39, 21))
113+
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 39, 9))
114114
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 39, 21))
115115
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 39, 50))
116116
>undefined : Symbol(undefined)
@@ -123,21 +123,21 @@ function f6() {
123123
>f6 : Symbol(f6, Decl(controlFlowDestructuringDeclaration.ts, 41, 1))
124124

125125
let { x }: { x?: string | number } = {};
126-
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 44, 16))
126+
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 44, 9))
127127
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 44, 16))
128128

129129
x;
130130
>x : Symbol(x, Decl(controlFlowDestructuringDeclaration.ts, 44, 9))
131131

132132
let { y }: { y?: string | undefined } = {};
133-
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 46, 16))
133+
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 46, 9))
134134
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 46, 16))
135135

136136
y;
137137
>y : Symbol(y, Decl(controlFlowDestructuringDeclaration.ts, 46, 9))
138138

139139
let { z = "" }: { z?: string | undefined } = {};
140-
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 48, 21))
140+
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 48, 9))
141141
>z : Symbol(z, Decl(controlFlowDestructuringDeclaration.ts, 48, 21))
142142

143143
z;

tests/baselines/reference/controlFlowDestructuringDeclaration.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function f4() {
9999
>y : string
100100

101101
let { z = "" }: { z: string | undefined } = { z: undefined };
102-
>z : string | undefined
102+
>z : string
103103
>"" : ""
104104
>z : string | undefined
105105
>{ z: undefined } : { z: undefined; }
@@ -134,7 +134,7 @@ function f5() {
134134
>y : string
135135

136136
let { z = "" }: { z?: string | undefined } = { z: undefined };
137-
>z : string | undefined
137+
>z : string
138138
>"" : ""
139139
>z : string | undefined
140140
>{ z: undefined } : { z: undefined; }
@@ -165,7 +165,7 @@ function f6() {
165165
>y : string | undefined
166166

167167
let { z = "" }: { z?: string | undefined } = {};
168-
>z : string | undefined
168+
>z : string
169169
>"" : ""
170170
>z : string | undefined
171171
>{} : {}

0 commit comments

Comments
 (0)