|
| 1 | +=== tests/cases/compiler/strictFunctionTypes1.ts === |
| 2 | +declare function f1<T>(f1: (x: T) => void, f2: (x: T) => void): (x: T) => void; |
| 3 | +>f1 : Symbol(f1, Decl(strictFunctionTypes1.ts, 0, 0)) |
| 4 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 0, 20)) |
| 5 | +>f1 : Symbol(f1, Decl(strictFunctionTypes1.ts, 0, 23)) |
| 6 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 0, 28)) |
| 7 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 0, 20)) |
| 8 | +>f2 : Symbol(f2, Decl(strictFunctionTypes1.ts, 0, 42)) |
| 9 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 0, 48)) |
| 10 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 0, 20)) |
| 11 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 0, 65)) |
| 12 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 0, 20)) |
| 13 | + |
| 14 | +declare function f2<T>(obj: T, f1: (x: T) => void, f2: (x: T) => void): T; |
| 15 | +>f2 : Symbol(f2, Decl(strictFunctionTypes1.ts, 0, 79)) |
| 16 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 1, 20)) |
| 17 | +>obj : Symbol(obj, Decl(strictFunctionTypes1.ts, 1, 23)) |
| 18 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 1, 20)) |
| 19 | +>f1 : Symbol(f1, Decl(strictFunctionTypes1.ts, 1, 30)) |
| 20 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 1, 36)) |
| 21 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 1, 20)) |
| 22 | +>f2 : Symbol(f2, Decl(strictFunctionTypes1.ts, 1, 50)) |
| 23 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 1, 56)) |
| 24 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 1, 20)) |
| 25 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 1, 20)) |
| 26 | + |
| 27 | +declare function f3<T>(obj: T, f1: (x: T) => void, f2: (f: (x: T) => void) => void): T; |
| 28 | +>f3 : Symbol(f3, Decl(strictFunctionTypes1.ts, 1, 74)) |
| 29 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 2, 20)) |
| 30 | +>obj : Symbol(obj, Decl(strictFunctionTypes1.ts, 2, 23)) |
| 31 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 2, 20)) |
| 32 | +>f1 : Symbol(f1, Decl(strictFunctionTypes1.ts, 2, 30)) |
| 33 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 2, 36)) |
| 34 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 2, 20)) |
| 35 | +>f2 : Symbol(f2, Decl(strictFunctionTypes1.ts, 2, 50)) |
| 36 | +>f : Symbol(f, Decl(strictFunctionTypes1.ts, 2, 56)) |
| 37 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 2, 60)) |
| 38 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 2, 20)) |
| 39 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 2, 20)) |
| 40 | + |
| 41 | +interface Func<T> { (x: T): void } |
| 42 | +>Func : Symbol(Func, Decl(strictFunctionTypes1.ts, 2, 87)) |
| 43 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 4, 15)) |
| 44 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 4, 21)) |
| 45 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 4, 15)) |
| 46 | + |
| 47 | +declare function f4<T>(f1: Func<T>, f2: Func<T>): Func<T>; |
| 48 | +>f4 : Symbol(f4, Decl(strictFunctionTypes1.ts, 4, 34)) |
| 49 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 6, 20)) |
| 50 | +>f1 : Symbol(f1, Decl(strictFunctionTypes1.ts, 6, 23)) |
| 51 | +>Func : Symbol(Func, Decl(strictFunctionTypes1.ts, 2, 87)) |
| 52 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 6, 20)) |
| 53 | +>f2 : Symbol(f2, Decl(strictFunctionTypes1.ts, 6, 35)) |
| 54 | +>Func : Symbol(Func, Decl(strictFunctionTypes1.ts, 2, 87)) |
| 55 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 6, 20)) |
| 56 | +>Func : Symbol(Func, Decl(strictFunctionTypes1.ts, 2, 87)) |
| 57 | +>T : Symbol(T, Decl(strictFunctionTypes1.ts, 6, 20)) |
| 58 | + |
| 59 | +declare function fo(x: Object): void; |
| 60 | +>fo : Symbol(fo, Decl(strictFunctionTypes1.ts, 6, 58)) |
| 61 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 8, 20)) |
| 62 | +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) |
| 63 | + |
| 64 | +declare function fs(x: string): void; |
| 65 | +>fs : Symbol(fs, Decl(strictFunctionTypes1.ts, 8, 37)) |
| 66 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 9, 20)) |
| 67 | + |
| 68 | +declare function fx(f: (x: "def") => void): void; |
| 69 | +>fx : Symbol(fx, Decl(strictFunctionTypes1.ts, 9, 37)) |
| 70 | +>f : Symbol(f, Decl(strictFunctionTypes1.ts, 10, 20)) |
| 71 | +>x : Symbol(x, Decl(strictFunctionTypes1.ts, 10, 24)) |
| 72 | + |
| 73 | +const x1 = f1(fo, fs); // (x: string) => void |
| 74 | +>x1 : Symbol(x1, Decl(strictFunctionTypes1.ts, 12, 5)) |
| 75 | +>f1 : Symbol(f1, Decl(strictFunctionTypes1.ts, 0, 0)) |
| 76 | +>fo : Symbol(fo, Decl(strictFunctionTypes1.ts, 6, 58)) |
| 77 | +>fs : Symbol(fs, Decl(strictFunctionTypes1.ts, 8, 37)) |
| 78 | + |
| 79 | +const x2 = f2("abc", fo, fs); // "abc" |
| 80 | +>x2 : Symbol(x2, Decl(strictFunctionTypes1.ts, 13, 5)) |
| 81 | +>f2 : Symbol(f2, Decl(strictFunctionTypes1.ts, 0, 79)) |
| 82 | +>fo : Symbol(fo, Decl(strictFunctionTypes1.ts, 6, 58)) |
| 83 | +>fs : Symbol(fs, Decl(strictFunctionTypes1.ts, 8, 37)) |
| 84 | + |
| 85 | +const x3 = f3("abc", fo, fx); // "abc" | "def" |
| 86 | +>x3 : Symbol(x3, Decl(strictFunctionTypes1.ts, 14, 5)) |
| 87 | +>f3 : Symbol(f3, Decl(strictFunctionTypes1.ts, 1, 74)) |
| 88 | +>fo : Symbol(fo, Decl(strictFunctionTypes1.ts, 6, 58)) |
| 89 | +>fx : Symbol(fx, Decl(strictFunctionTypes1.ts, 9, 37)) |
| 90 | + |
| 91 | +const x4 = f4(fo, fs); // Func<string> |
| 92 | +>x4 : Symbol(x4, Decl(strictFunctionTypes1.ts, 15, 5)) |
| 93 | +>f4 : Symbol(f4, Decl(strictFunctionTypes1.ts, 4, 34)) |
| 94 | +>fo : Symbol(fo, Decl(strictFunctionTypes1.ts, 6, 58)) |
| 95 | +>fs : Symbol(fs, Decl(strictFunctionTypes1.ts, 8, 37)) |
| 96 | + |
0 commit comments