Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don’t crash when creating a union signature from signatures that do a…
…nd don’t have this types
- Loading branch information
1 parent
6a559e3
commit 300cbef
Showing
5 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//// [unionTypeCallSignatures5.ts] | ||
// #31485 | ||
interface A { | ||
(this: void, b?: number): void; | ||
} | ||
interface B { | ||
(this: number, b?: number): void; | ||
} | ||
interface C { | ||
(i: number): void; | ||
} | ||
declare const fn: A | B | C; | ||
fn(0); | ||
|
||
|
||
//// [unionTypeCallSignatures5.js] | ||
fn(0); |
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/unionTypeCallSignatures5.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
=== tests/cases/conformance/types/union/unionTypeCallSignatures5.ts === | ||
// #31485 | ||
interface A { | ||
>A : Symbol(A, Decl(unionTypeCallSignatures5.ts, 0, 0)) | ||
|
||
(this: void, b?: number): void; | ||
>this : Symbol(this, Decl(unionTypeCallSignatures5.ts, 2, 3)) | ||
>b : Symbol(b, Decl(unionTypeCallSignatures5.ts, 2, 14)) | ||
} | ||
interface B { | ||
>B : Symbol(B, Decl(unionTypeCallSignatures5.ts, 3, 1)) | ||
|
||
(this: number, b?: number): void; | ||
>this : Symbol(this, Decl(unionTypeCallSignatures5.ts, 5, 3)) | ||
>b : Symbol(b, Decl(unionTypeCallSignatures5.ts, 5, 16)) | ||
} | ||
interface C { | ||
>C : Symbol(C, Decl(unionTypeCallSignatures5.ts, 6, 1)) | ||
|
||
(i: number): void; | ||
>i : Symbol(i, Decl(unionTypeCallSignatures5.ts, 8, 3)) | ||
} | ||
declare const fn: A | B | C; | ||
>fn : Symbol(fn, Decl(unionTypeCallSignatures5.ts, 10, 13)) | ||
>A : Symbol(A, Decl(unionTypeCallSignatures5.ts, 0, 0)) | ||
>B : Symbol(B, Decl(unionTypeCallSignatures5.ts, 3, 1)) | ||
>C : Symbol(C, Decl(unionTypeCallSignatures5.ts, 6, 1)) | ||
|
||
fn(0); | ||
>fn : Symbol(fn, Decl(unionTypeCallSignatures5.ts, 10, 13)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
=== tests/cases/conformance/types/union/unionTypeCallSignatures5.ts === | ||
// #31485 | ||
interface A { | ||
(this: void, b?: number): void; | ||
>this : void | ||
>b : number | ||
} | ||
interface B { | ||
(this: number, b?: number): void; | ||
>this : number | ||
>b : number | ||
} | ||
interface C { | ||
(i: number): void; | ||
>i : number | ||
} | ||
declare const fn: A | B | C; | ||
>fn : A | B | C | ||
|
||
fn(0); | ||
>fn(0) : void | ||
>fn : A | B | C | ||
>0 : 0 | ||
|
12 changes: 12 additions & 0 deletions
12
tests/cases/conformance/types/union/unionTypeCallSignatures5.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// #31485 | ||
interface A { | ||
(this: void, b?: number): void; | ||
} | ||
interface B { | ||
(this: number, b?: number): void; | ||
} | ||
interface C { | ||
(i: number): void; | ||
} | ||
declare const fn: A | B | C; | ||
fn(0); |