-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4307195
commit ddc7c3b
Showing
10 changed files
with
337 additions
and
7 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
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
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
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,34 @@ | ||
//// [typeCall.ts] | ||
type F1 = () => 1; | ||
type a = F1(); | ||
|
||
type F2 = (a: string) => 1; | ||
type b = F2('foo'); | ||
|
||
interface F3 { | ||
(): 1; | ||
(a: number): 2; | ||
(a: string): 3; | ||
} | ||
type c = F3(); | ||
type d = F3(123); | ||
type e = F3('foo'); | ||
|
||
declare function f4(a: string): 1; | ||
let a = 'foo'; | ||
type f = typeof f4(typeof a); | ||
|
||
type g = (() => 1)(); | ||
|
||
type Id = <T>(v: T) => T; | ||
type h = Id(123); | ||
|
||
type Wrap<T> = Id(T); | ||
type i = Wrap<123>; | ||
|
||
type F5 = () => () => { a: () => 1; }; | ||
type j = F5()()['a'](); | ||
|
||
|
||
//// [typeCall.js] | ||
var a = 'foo'; |
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,82 @@ | ||
=== tests/cases/compiler/typeCall.ts === | ||
type F1 = () => 1; | ||
>F1 : Symbol(F1, Decl(typeCall.ts, 0, 0)) | ||
|
||
type a = F1(); | ||
>a : Symbol(a, Decl(typeCall.ts, 0, 18), Decl(typeCall.ts, 16, 3)) | ||
>F1 : Symbol(F1, Decl(typeCall.ts, 0, 0)) | ||
|
||
type F2 = (a: string) => 1; | ||
>F2 : Symbol(F2, Decl(typeCall.ts, 1, 14)) | ||
>a : Symbol(a, Decl(typeCall.ts, 3, 11)) | ||
|
||
type b = F2('foo'); | ||
>b : Symbol(b, Decl(typeCall.ts, 3, 27)) | ||
>F2 : Symbol(F2, Decl(typeCall.ts, 1, 14)) | ||
|
||
interface F3 { | ||
>F3 : Symbol(F3, Decl(typeCall.ts, 4, 19)) | ||
|
||
(): 1; | ||
(a: number): 2; | ||
>a : Symbol(a, Decl(typeCall.ts, 8, 5)) | ||
|
||
(a: string): 3; | ||
>a : Symbol(a, Decl(typeCall.ts, 9, 5)) | ||
} | ||
type c = F3(); | ||
>c : Symbol(c, Decl(typeCall.ts, 10, 1)) | ||
>F3 : Symbol(F3, Decl(typeCall.ts, 4, 19)) | ||
|
||
type d = F3(123); | ||
>d : Symbol(d, Decl(typeCall.ts, 11, 14)) | ||
>F3 : Symbol(F3, Decl(typeCall.ts, 4, 19)) | ||
|
||
type e = F3('foo'); | ||
>e : Symbol(e, Decl(typeCall.ts, 12, 17)) | ||
>F3 : Symbol(F3, Decl(typeCall.ts, 4, 19)) | ||
|
||
declare function f4(a: string): 1; | ||
>f4 : Symbol(f4, Decl(typeCall.ts, 13, 19)) | ||
>a : Symbol(a, Decl(typeCall.ts, 15, 20)) | ||
|
||
let a = 'foo'; | ||
>a : Symbol(a, Decl(typeCall.ts, 0, 18), Decl(typeCall.ts, 16, 3)) | ||
|
||
type f = typeof f4(typeof a); | ||
>f : Symbol(f, Decl(typeCall.ts, 16, 14)) | ||
>f4 : Symbol(f4, Decl(typeCall.ts, 13, 19)) | ||
>a : Symbol(a, Decl(typeCall.ts, 0, 18), Decl(typeCall.ts, 16, 3)) | ||
|
||
type g = (() => 1)(); | ||
>g : Symbol(g, Decl(typeCall.ts, 17, 29)) | ||
|
||
type Id = <T>(v: T) => T; | ||
>Id : Symbol(Id, Decl(typeCall.ts, 19, 21)) | ||
>T : Symbol(T, Decl(typeCall.ts, 21, 11)) | ||
>v : Symbol(v, Decl(typeCall.ts, 21, 14)) | ||
>T : Symbol(T, Decl(typeCall.ts, 21, 11)) | ||
>T : Symbol(T, Decl(typeCall.ts, 21, 11)) | ||
|
||
type h = Id(123); | ||
>h : Symbol(h, Decl(typeCall.ts, 21, 25)) | ||
>Id : Symbol(Id, Decl(typeCall.ts, 19, 21)) | ||
|
||
type Wrap<T> = Id(T); | ||
>Wrap : Symbol(Wrap, Decl(typeCall.ts, 22, 17)) | ||
>T : Symbol(T, Decl(typeCall.ts, 24, 10)) | ||
>Id : Symbol(Id, Decl(typeCall.ts, 19, 21)) | ||
>T : Symbol(T, Decl(typeCall.ts, 24, 10)) | ||
|
||
type i = Wrap<123>; | ||
>i : Symbol(i, Decl(typeCall.ts, 24, 21)) | ||
>Wrap : Symbol(Wrap, Decl(typeCall.ts, 22, 17)) | ||
|
||
type F5 = () => () => { a: () => 1; }; | ||
>F5 : Symbol(F5, Decl(typeCall.ts, 25, 19)) | ||
>a : Symbol(a, Decl(typeCall.ts, 27, 23)) | ||
|
||
type j = F5()()['a'](); | ||
>j : Symbol(j, Decl(typeCall.ts, 27, 38)) | ||
>F5 : Symbol(F5, Decl(typeCall.ts, 25, 19)) | ||
|
Oops, something went wrong.