8000 fix the other codepath · microsoft/TypeScript@425647d · GitHub
[go: up one dir, main page]

Skip to content

Commit 425647d

Browse files
committed
fix the other codepath
1 parent 8dfb1c0 commit 425647d

8 files changed

+24
-76
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 10000 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11979,7 +11979,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1197911979
if (!links.writeType && links.deferralWriteConstituents) {
1198011980
Debug.assertIsDefined(links.deferralParent);
1198111981
Debug.assertIsDefined(links.deferralConstituents);
11982-
links.writeType = links.deferralParent.flags & TypeFlags.Union ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
11982+
links.writeType = links.deferralParent.flags & TypeFlags.Union ? getIntersectionType(links.deferralWriteConstituents) : getUnionType(links.deferralWriteConstituents);
1198311983
}
1198411984
return links.writeType;
1198511985
}

tests/baselines/reference/divergentAccessorsTypes5.errors.txt

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/baselines/reference/divergentAccessorsTypes5.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ class Three {
3131
declare const i: One & Two & Three;
3232

3333
// "hello"
34-
i.prop1 = 42; // error
34+
i.prop1 = 42;
3535
i.prop1 = "hello";
3636

3737
// 42
3838
i.prop2 = 42;
39-
i.prop2 = "hello"; // error
39+
i.prop2 = "hello";
4040

4141

4242
//// [divergentAccessorsTypes5.js]
@@ -88,8 +88,8 @@ var Three = /** @class */ (function () {
8888
return Three;
8989
}());
9090
// "hello"
91-
i.prop1 = 42; // error
91+
i.prop1 = 42;
9292
i.prop1 = "hello";
9393
// 42
9494
i.prop2 = 42;
95-
i.prop2 = "hello"; // error
95+
i.prop2 = "hello";

tests/baselines/reference/divergentAccessorsTypes5.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ declare const i: One & Two & Three;
6262
>Three : Symbol(Three, Decl(divergentAccessorsTypes5.ts, 17, 1))
6363

6464
// "hello"
65-
i.prop1 = 42; // error
65+
i.prop1 = 42;
6666
>i.prop1 : Symbol(prop1, Decl(divergentAccessorsTypes5.ts, 3, 11), Decl(divergentAccessorsTypes5.ts, 4, 36), Decl(divergentAccessorsTypes5.ts, 10, 11), Decl(divergentAccessorsTypes5.ts, 11, 42), Decl(divergentAccessorsTypes5.ts, 19, 13) ... and 1 more)
6767
>i : Symbol(i, Decl(divergentAccessorsTypes5.ts, 27, 13))
6868
>prop1 : Symbol(prop1, Decl(divergentAccessorsTypes5.ts, 3, 11), Decl(divergentAccessorsTypes5.ts, 4, 36), Decl(divergentAccessorsTypes5.ts, 10, 11), Decl(divergentAccessorsTypes5.ts, 11, 42), Decl(divergentAccessorsTypes5.ts, 19, 13) ... and 1 more)
@@ -78,7 +78,7 @@ i.prop2 = 42;
7878
>i : Symbol(i, Decl(divergentAccessorsTypes5.ts, 27, 13))
7979
>prop2 : Symbol(prop2, Decl(divergentAccessorsTypes5.ts, 5, 35), Decl(divergentAccessorsTypes5.ts, 12, 36), Decl(divergentAccessorsTypes5.ts, 14, 36), Decl(divergentAccessorsTypes5.ts, 21, 37), Decl(divergentAccessorsTypes5.ts, 23, 36))
8080

81-
i.prop2 = "hello"; // error
81+
i.prop2 = "hello";
8282
>i.prop2 : Symbol(prop2, Decl(divergentAccessorsTypes5.ts, 5, 35), Decl(divergentAccessorsTypes5.ts, 12, 36), Decl(divergentAccessorsTypes5.ts, 14, 36), Decl(divergentAccessorsTypes5.ts, 21, 37), Decl(divergentAccessorsTypes5.ts, 23, 36))
8383
>i : Symbol(i, Decl(divergentAccessorsTypes5.ts, 27, 13))
8484
>prop2 : Symbol(prop2, Decl(divergentAccessorsTypes5.ts, 5, 35), Decl(divergentAccessorsTypes5.ts, 12, 36), Decl(divergentAccessorsTypes5.ts, 14, 36), Decl(divergentAccessorsTypes5.ts, 21, 37), Decl(divergentAccessorsTypes5.ts, 23, 36))

tests/baselines/reference/divergentAccessorsTypes5.types

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,32 @@ declare const i: One & Two & Three;
6464
>i : One & Two & Three
6565

6666
// "hello"
67-
i.prop1 = 42; // error
67+
i.prop1 = 42;
6868
>i.prop1 = 42 : 42
69-
>i.prop1 : "hello"
69+
>i.prop1 : string | number | boolean
7070
>i : One & Two & Three
71-
>prop1 : "hello"
71+
>prop1 : string | number | boolean
7272
>42 : 42
7373

7474
i.prop1 = "hello";
7575
>i.prop1 = "hello" : "hello"
76-
>i.prop1 : "hello"
76+
>i.prop1 : string | number | boolean
7777
>i : One & Two & Three
78-
>prop1 : "hello"
78+
>prop1 : string | number | boolean
7979
>"hello" : "hello"
8080

8181
// 42
8282
i.prop2 = 42;
8383
>i.prop2 = 42 : 42
84-
>i.prop2 : 42
84+
>i.prop2 : string | number | boolean
8585
>i : One & Two & Three
86-
>prop2 : 42
86+
>prop2 : string | number | boolean
8787
>42 : 42
8888

89-
i.prop2 = "hello"; // error
89+
i.prop2 = "hello";
9090
>i.prop2 = "hello" : "hello"
91-
>i.prop2 : 42
91+
>i. A92E prop2 : string | number | boolean
9292
>i : One & Two & Three
93-
>prop2 : 42
93+
>prop2 : string | number | boolean
9494
>"hello" : "hello"
9595

tests/baselines/reference/divergentAccessorsTypes8.errors.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ divergentAccessorsTypes8.ts(72,1): error TS2322: Type 'string' is not assignable
55
divergentAccessorsTypes8.ts(73,1): error TS2322: Type 'boolean' is not assignable to type 'never'.
66
divergentAccessorsTypes8.ts(75,1): error TS2322: Type 'number' is not assignable to type 'string'.
77
divergentAccessorsTypes8.ts(77,1): error TS2322: Type 'boolean' is not assignable to type 'string'.
8-
divergentAccessorsTypes8.ts(124,1): error TS2322: Type '42' is not assignable to type '"hello"'.
9-
divergentAccessorsTypes8.ts(128,1): error TS2322: Type '"hello"' is not assignable to type '42'.
108
divergentAccessorsTypes8.ts(146,1): error TS2322: Type 'number' is not assignable to type 'boolean'.
119
divergentAccessorsTypes8.ts(148,1): error TS2322: Type 'string' is not assignable to type 'boolean'.
1210
divergentAccessorsTypes8.ts(149,1): error TS2322: Type 'null' is not assignable to type 'boolean'.
1311

1412

15-
==== divergentAccessorsTypes8.ts (12 errors) ====
13+
==== divergentAccessorsTypes8.ts (10 errors) ====
1614
export {}
1715

1816
interface Serializer {
@@ -151,14 +149,10 @@ divergentAccessorsTypes8.ts(149,1): error TS2322: Type 'null' is not assignable
151149
declare const i2: Three & Four & Five;
152150

153151
i2['prop1'] = 42;
154-
~~~~~~~~~~~
155-
!!! error TS2322: Type '42' is not assignable to type '"hello"'.
156152
i2['prop1'] = "hello";
157153

158154
i2['prop2'] = 42;
159155
i2['prop2'] = "hello";
160-
~~~~~~~~~~~
161-
!!! error TS2322: Type '"hello"' is not assignable to type '42'.
162156

163157
class Six {
164158
get prop1(): boolean | number {

tests/baselines/reference/divergentAccessorsTypes8.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,28 +338,28 @@ declare const i2: Three & Four & Five;
338338

339339
i2['prop1'] = 42;
340340
>i2['prop1'] = 42 : 42
341-
>i2['prop1'] : "hello"
341+
>i2['prop1'] : string | number | boolean
342342
>i2 : Three & Four & Five
343343
>'prop1' : "prop1"
344344
>42 : 42
345345

346346
i2['prop1'] = "hello";
347347
>i2['prop1'] = "hello" : "hello"
348-
>i2['prop1'] : "hello"
348+
>i2['prop1'] : string | number | boolean
349349
>i2 : Three & Four & Five
350350
>'prop1' : "prop1"
351351
>"hello" : "hello"
352352

353353
i2['prop2'] = 42;
354354
>i2['prop2'] = 42 : 42
355-
>i2['prop2'] : 42
355+
>i2['prop2'] : string | number | boolean
356356
>i2 : Three & Four & Five
357357
>'prop2' : "prop2"
358358
>42 : 42
359359

360360
i2['prop2'] = "hello";
361361
>i2['prop2'] = "hello" : "hello"
362-
>i2['prop2'] : 42
362+
>i2['prop2'] : string | number | boolean
363363
>i2 : Three & Four & Five
364364
>'prop2' : "prop2"
365365
>"hello" : "hello"

tests/cases/compiler/divergentAccessorsTypes5.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class Three {
3030
declare const i: One & Two & Three;
3131

3232
// "hello"
33-
i.prop1 = 42; // error
33+
i.prop1 = 42;
3434
i.prop1 = "hello";
3535

3636
// 42
3737
i.prop2 = 42;
38-
i.prop2 = "hello"; // error
38+
i.prop2 = "hello";

0 commit comments

Comments
 (0)
0