Skip to content

Commit 798be6f

Browse files
committed
Add new test baseline and delete else in binder
The extra `else` caused a ton of test failures!
1 parent 7205750 commit 798be6f

File tree

4 files changed

+157
-33
lines changed

4 files changed

+157
-33
lines changed

src/compiler/binder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ namespace ts {
328328
classifiableNames[name] = name;
329329
}
330330

331-
else if (symbol.flags & excludes) {
331+
if (symbol.flags & excludes) {
332332
if (symbol.isDiscardable) {
333333
// Javascript constructor-declared symbols can be discarded in favor of
334334
// prototype symbols like methods.

tests/baselines/reference/multipleDeclarations.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
//// [input.js]
2-
32
function C() {
43
this.m = null;
54
}
65
C.prototype.m = function() {
76
this.nothing();
87
}
9-
108
class X {
119
constructor() {
1210
this.m = this.m.bind(this);
@@ -21,6 +19,20 @@ let x = new X();
2119
X.prototype.mistake = false;
2220
x.m();
2321
x.mistake;
22+
class Y {
23+
mistake() {
24+
}
25+
m() {
26+
}
27+
constructor() {
28+
this.m = this.m.bind(this);
29+
this.mistake = 'even more nonsense';
30+
}
31+
}
32+
Y.prototype.mistake = true;
33+
let y = new Y();
34+
y.m();
35+
y.mistake();
2436

2537

2638
//// [output.js]
@@ -45,3 +57,18 @@ var x = new X();
4557
X.prototype.mistake = false;
4658
x.m();
4759
x.mistake;
60+
var Y = (function () {
61+
function Y() {
62+
this.m = this.m.bind(this);
63+
this.mistake = 'even more nonsense';
64+
}
65+
Y.prototype.mistake = function () {
66+
};
67+
Y.prototype.m = function () {
68+
};
69+
return Y;
70+
}());
71+
Y.prototype.mistake = true;
72+
var y = new Y();
73+
y.m();
74+
y.mistake();
Lines changed: 70 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,106 @@
11
=== tests/cases/conformance/salsa/input.js ===
2-
32
function C() {
43
>C : Symbol(C, Decl(input.js, 0, 0))
54

65
this.m = null;
7-
>m : Symbol(C.m, Decl(input.js, 1, 14), Decl(input.js, 3, 1))
6+
>m : Symbol(C.m, Decl(input.js, 0, 14), Decl(input.js, 2, 1))
87
}
98
C.prototype.m = function() {
10-
>C.prototype : Symbol(C.m, Decl(input.js, 1, 14), Decl(input.js, 3, 1))
9+
>C.prototype : Symbol(C.m, Decl(input.js, 0, 14), Decl(input.js, 2, 1))
1110
>C : Symbol(C, Decl(input.js, 0, 0))
1211
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
13-
>m : Symbol(C.m, Decl(input.js, 1, 14), Decl(input.js, 3, 1))
12+
>m : Symbol(C.m, Decl(input.js, 0, 14), Decl(input.js, 2, 1))
1413

1514
this.nothing();
1615
>this : Symbol(C, Decl(input.js, 0, 0))
1716
}
18-
1917
class X {
20-
>X : Symbol(X, Decl(input.js, 6, 1))
18+
>X : Symbol(X, Decl(input.js, 5, 1))
2119

2220
constructor() {
2321
this.m = this.m.bind(this);
24-
>this.m : Symbol(X.m, Decl(input.js, 12, 5))
25-
>this : Symbol(X, Decl(input.js, 6, 1))
26-
>m : Symbol(X.m, Decl(input.js, 9, 19))
22+
>this.m : Symbol(X.m, Decl(input.js, 10, 5))
23+
>this : Symbol(X, Decl(input.js, 5, 1))
24+
>m : Symbol(X.m, Decl(input.js, 7, 19))
2725
>this.m.bind : Symbol(Function.bind, Decl(lib.d.ts, --, --))
28-
>this.m : Symbol(X.m, Decl(input.js, 12, 5))
29-
>this : Symbol(X, Decl(input.js, 6, 1))
30-
>m : Symbol(X.m, Decl(input.js, 12, 5))
26+
>this.m : Symbol(X.m, Decl(input.js, 10, 5))
27+
>this : Symbol(X, Decl(input.js, 5, 1))
28+
>m : Symbol(X.m, Decl(input.js, 10, 5))
3129
>bind : Symbol(Function.bind, Decl(lib.d.ts, --, --))
32-
>this : Symbol(X, Decl(input.js, 6, 1))
30+
>this : Symbol(X, Decl(input.js, 5, 1))
3331

3432
this.mistake = 'frankly, complete nonsense';
35-
>this.mistake : Symbol(X.mistake, Decl(input.js, 14, 5))
36-
>this : Symbol(X, Decl(input.js, 6, 1))
37-
>mistake : Symbol(X.mistake, Decl(input.js, 10, 35))
33+
>this.mistake : Symbol(X.mistake, Decl(input.js, 12, 5))
34+
>this : Symbol(X, Decl(input.js, 5, 1))
35+
>mistake : Symbol(X.mistake, Decl(input.js, 8, 35))
3836
}
3937
m() {
40-
>m : Symbol(X.m, Decl(input.js, 12, 5))
38+
>m : Symbol(X.m, Decl(input.js, 10, 5))
4139
}
4240
mistake() {
43-
>mistake : Symbol(X.mistake, Decl(input.js, 14, 5))
41+
>mistake : Symbol(X.mistake, Decl(input.js, 12, 5))
4442
}
4543
}
4644
let x = new X();
47-
>x : Symbol(x, Decl(input.js, 18, 3))
48-
>X : Symbol(X, Decl(input.js, 6, 1))
45+
>x : Symbol(x, Decl(input.js, 16, 3))
46+
>X : Symbol(X, Decl(input.js, 5, 1))
4947

5048
X.prototype.mistake = false;
51-
>X.prototype.mistake : Symbol(X.mistake, Decl(input.js, 14, 5))
52-
>X : Symbol(X, Decl(input.js, 6, 1))
49+
>X.prototype.mistake : Symbol(X.mistake, Decl(input.js, 12, 5))
50+
>X : Symbol(X, Decl(input.js, 5, 1))
5351
>prototype : Symbol(X.prototype)
5452

5553
x.m();
56-
>x.m : Symbol(X.m, Decl(input.js, 12, 5))
57-
>x : Symbol(x, Decl(input.js, 18, 3))
58-
>m : Symbol(X.m, Decl(input.js, 12, 5))
54+
>x.m : Symbol(X.m, Decl(input.js, 10, 5))
55+
>x : Symbol(x, Decl(input.js, 16, 3))
56+
>m : Symbol(X.m, Decl(input.js, 10, 5))
5957

6058
x.mistake;
61-
>x.mistake : Symbol(X.mistake, Decl(input.js, 14, 5))
62-
>x : Symbol(x, Decl(input.js, 18, 3))
63-
>mistake : Symbol(X.mistake, Decl(input.js, 14, 5))
59+
>x.mistake : Symbol(X.mistake, Decl(input.js, 12, 5))
60+
>x : Symbol(x, Decl(input.js, 16, 3))
61+
>mistake : Symbol(X.mistake, Decl(input.js, 12, 5))
62+
63+
class Y {
64+
>Y : Symbol(Y, Decl(input.js, 19, 10))
65+
66+
mistake() {
67+
>mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35))
68+
}
69+
m() {
70+
>m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19))
71+
}
72+
constructor() {
73+
this.m = this.m.bind(this);
74+
>this.m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19))
75+
>this : Symbol(Y, Decl(input.js, 19, 10))
76+
>m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19))
77+
>this.m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19))
78+
>this : Symbol(Y, Decl(input.js, 19, 10))
79+
>m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19))
80+
>this : Symbol(Y, Decl(input.js, 19, 10))
81+
82+
this.mistake = 'even more nonsense';
83+
>this.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35))
84+
>this : Symbol(Y, Decl(input.js, 19, 10))
85+
>mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35))
86+
}
87+
}
88+
Y.prototype.mistake = true;
89+
>Y.prototype.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35))
90+
>Y : Symbol(Y, Decl(input.js, 19, 10))
91+
>prototype : Symbol(Y.prototype)
92+
93+
let y = new Y();
94+
>y : Symbol(y, Decl(input.js, 31, 3))
95+
>Y : Symbol(Y, Decl(input.js, 19, 10))
96+
97+
y.m();
98+
>y.m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19))
99+
>y : Symbol(y, Decl(input.js, 31, 3))
100+
>m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19))
101+
102+
y.mistake();
103+
>y.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35))
104+
>y : Symbol(y, Decl(input.js, 31, 3))
105+
>mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35))
64106

tests/baselines/reference/multipleDeclarations.types

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
=== tests/cases/conformance/salsa/input.js ===
2-
32
function C() {
43
>C : () => void
54

@@ -25,7 +24,6 @@ C.prototype.m = function() {
2524
>this : { m: () => void; }
2625
>nothing : any
2726
}
28-
2927
class X {
3028
>X : X
3129

@@ -82,3 +80,60 @@ x.mistake;
8280
>x : X
8381
>mistake : () => void
8482

83+
class Y {
84+
>Y : Y
85+
86+
mistake() {
87+
>mistake : any
88+
}
89+
m() {
90+
>m : any
91+
}
92+
constructor() {
93+
this.m = this.m.bind(this);
94+
>this.m = this.m.bind(this) : any
95+
>this.m : any
96+
>this : this
97+
>m : any
98+
>this.m.bind(this) : any
99+
>this.m.bind : any
100+
>this.m : any
101+
>this : this
102+
>m : any
103+
>bind : any
104+
>this : this
105+
106+
this.mistake = 'even more nonsense';
107+
>this.mistake = 'even more nonsense' : string
108+
>this.mistake : any
109+
>this : this
110+
>mistake : any
111+
>'even more nonsense' : string
112+
}
113+
}
114+
Y.prototype.mistake = true;
115+
>Y.prototype.mistake = true : boolean
116+
>Y.prototype.mistake : any
117+
>Y.prototype : Y
118+
>Y : typeof Y
119+
>prototype : Y
120+
>mistake : any
121+
>true : boolean
122+
123+
let y = new Y();
124+
>y : Y
125+
>new Y() : Y
126+
>Y : typeof Y
127+
128+
y.m();
129+
>y.m() : any
130+
>y.m : any
131+
>y : Y
132+
>m : any
133+
134+
y.mistake();
135+
>y.mistake() : any
136+
>y.mistake : any
137+
>y : Y
138+
>mistake : any
139+

0 commit comments

Comments
 (0)