mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-29 19:42:39 -05:00
Add tests
This commit is contained in:
12
tests/baselines/reference/inferringAnyFunctionType1.js
Normal file
12
tests/baselines/reference/inferringAnyFunctionType1.js
Normal file
@@ -0,0 +1,12 @@
|
||||
//// [inferringAnyFunctionType1.ts]
|
||||
function f<T extends { "0": (p1: number) => number }>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
|
||||
//// [inferringAnyFunctionType1.js]
|
||||
function f(p) {
|
||||
return p;
|
||||
}
|
||||
var v = f([function (x) { return x; }]);
|
||||
19
tests/baselines/reference/inferringAnyFunctionType1.symbols
Normal file
19
tests/baselines/reference/inferringAnyFunctionType1.symbols
Normal file
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType1.ts ===
|
||||
function f<T extends { "0": (p1: number) => number }>(p: T): T {
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType1.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType1.ts, 0, 11))
|
||||
>p1 : Symbol(p1, Decl(inferringAnyFunctionType1.ts, 0, 29))
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType1.ts, 0, 54))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType1.ts, 0, 11))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType1.ts, 0, 11))
|
||||
|
||||
return p;
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType1.ts, 0, 54))
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
>v : Symbol(v, Decl(inferringAnyFunctionType1.ts, 4, 3))
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType1.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType1.ts, 4, 11))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType1.ts, 4, 11))
|
||||
|
||||
22
tests/baselines/reference/inferringAnyFunctionType1.types
Normal file
22
tests/baselines/reference/inferringAnyFunctionType1.types
Normal file
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType1.ts ===
|
||||
function f<T extends { "0": (p1: number) => number }>(p: T): T {
|
||||
>f : <T extends { "0": (p1: number) => number; }>(p: T) => T
|
||||
>T : T
|
||||
>p1 : number
|
||||
>p : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return p;
|
||||
>p : T
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
>v : [(x: number) => number]
|
||||
>f([x => x]) : [(x: number) => number]
|
||||
>f : <T extends { "0": (p1: number) => number; }>(p: T) => T
|
||||
>[x => x] : [(x: number) => number]
|
||||
>x => x : (x: number) => number
|
||||
>x : number
|
||||
>x : number
|
||||
|
||||
12
tests/baselines/reference/inferringAnyFunctionType2.js
Normal file
12
tests/baselines/reference/inferringAnyFunctionType2.js
Normal file
@@ -0,0 +1,12 @@
|
||||
//// [inferringAnyFunctionType2.ts]
|
||||
function f<T extends [(p1: number) => number]>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
|
||||
//// [inferringAnyFunctionType2.js]
|
||||
function f(p) {
|
||||
return p;
|
||||
}
|
||||
var v = f([function (x) { return x; }]);
|
||||
19
tests/baselines/reference/inferringAnyFunctionType2.symbols
Normal file
19
tests/baselines/reference/inferringAnyFunctionType2.symbols
Normal file
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType2.ts ===
|
||||
function f<T extends [(p1: number) => number]>(p: T): T {
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType2.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType2.ts, 0, 11))
|
||||
>p1 : Symbol(p1, Decl(inferringAnyFunctionType2.ts, 0, 23))
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType2.ts, 0, 47))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType2.ts, 0, 11))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType2.ts, 0, 11))
|
||||
|
||||
return p;
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType2.ts, 0, 47))
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
>v : Symbol(v, Decl(inferringAnyFunctionType2.ts, 4, 3))
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType2.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType2.ts, 4, 11))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType2.ts, 4, 11))
|
||||
|
||||
22
tests/baselines/reference/inferringAnyFunctionType2.types
Normal file
22
tests/baselines/reference/inferringAnyFunctionType2.types
Normal file
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType2.ts ===
|
||||
function f<T extends [(p1: number) => number]>(p: T): T {
|
||||
>f : <T extends [(p1: number) => number]>(p: T) => T
|
||||
>T : T
|
||||
>p1 : number
|
||||
>p : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return p;
|
||||
>p : T
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
>v : [(x: number) => number]
|
||||
>f([x => x]) : [(x: number) => number]
|
||||
>f : <T extends [(p1: number) => number]>(p: T) => T
|
||||
>[x => x] : [(x: number) => number]
|
||||
>x => x : (x: number) => number
|
||||
>x : number
|
||||
>x : number
|
||||
|
||||
12
tests/baselines/reference/inferringAnyFunctionType3.js
Normal file
12
tests/baselines/reference/inferringAnyFunctionType3.js
Normal file
@@ -0,0 +1,12 @@
|
||||
//// [inferringAnyFunctionType3.ts]
|
||||
function f<T extends ((p1: number) => number)[]>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
|
||||
//// [inferringAnyFunctionType3.js]
|
||||
function f(p) {
|
||||
return p;
|
||||
}
|
||||
var v = f([function (x) { return x; }]);
|
||||
19
tests/baselines/reference/inferringAnyFunctionType3.symbols
Normal file
19
tests/baselines/reference/inferringAnyFunctionType3.symbols
Normal file
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType3.ts ===
|
||||
function f<T extends ((p1: number) => number)[]>(p: T): T {
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType3.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType3.ts, 0, 11))
|
||||
>p1 : Symbol(p1, Decl(inferringAnyFunctionType3.ts, 0, 23))
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType3.ts, 0, 49))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType3.ts, 0, 11))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType3.ts, 0, 11))
|
||||
|
||||
return p;
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType3.ts, 0, 49))
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
>v : Symbol(v, Decl(inferringAnyFunctionType3.ts, 4, 3))
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType3.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType3.ts, 4, 11))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType3.ts, 4, 11))
|
||||
|
||||
22
tests/baselines/reference/inferringAnyFunctionType3.types
Normal file
22
tests/baselines/reference/inferringAnyFunctionType3.types
Normal file
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType3.ts ===
|
||||
function f<T extends ((p1: number) => number)[]>(p: T): T {
|
||||
>f : <T extends ((p1: number) => number)[]>(p: T) => T
|
||||
>T : T
|
||||
>p1 : number
|
||||
>p : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return p;
|
||||
>p : T
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
>v : ((x: number) => number)[]
|
||||
>f([x => x]) : ((x: number) => number)[]
|
||||
>f : <T extends ((p1: number) => number)[]>(p: T) => T
|
||||
>[x => x] : ((x: number) => number)[]
|
||||
>x => x : (x: number) => number
|
||||
>x : number
|
||||
>x : number
|
||||
|
||||
12
tests/baselines/reference/inferringAnyFunctionType4.js
Normal file
12
tests/baselines/reference/inferringAnyFunctionType4.js
Normal file
@@ -0,0 +1,12 @@
|
||||
//// [inferringAnyFunctionType4.ts]
|
||||
function f<T extends (p1: number) => number>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f(x => x);
|
||||
|
||||
//// [inferringAnyFunctionType4.js]
|
||||
function f(p) {
|
||||
return p;
|
||||
}
|
||||
var v = f(function (x) { return x; });
|
||||
19
tests/baselines/reference/inferringAnyFunctionType4.symbols
Normal file
19
tests/baselines/reference/inferringAnyFunctionType4.symbols
Normal file
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType4.ts ===
|
||||
function f<T extends (p1: number) => number>(p: T): T {
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType4.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType4.ts, 0, 11))
|
||||
>p1 : Symbol(p1, Decl(inferringAnyFunctionType4.ts, 0, 22))
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType4.ts, 0, 45))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType4.ts, 0, 11))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType4.ts, 0, 11))
|
||||
|
||||
return p;
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType4.ts, 0, 45))
|
||||
}
|
||||
|
||||
var v = f(x => x);
|
||||
>v : Symbol(v, Decl(inferringAnyFunctionType4.ts, 4, 3))
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType4.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType4.ts, 4, 10))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType4.ts, 4, 10))
|
||||
|
||||
21
tests/baselines/reference/inferringAnyFunctionType4.types
Normal file
21
tests/baselines/reference/inferringAnyFunctionType4.types
Normal file
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType4.ts ===
|
||||
function f<T extends (p1: number) => number>(p: T): T {
|
||||
>f : <T extends (p1: number) => number>(p: T) => T
|
||||
>T : T
|
||||
>p1 : number
|
||||
>p : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return p;
|
||||
>p : T
|
||||
}
|
||||
|
||||
var v = f(x => x);
|
||||
>v : (x: number) => number
|
||||
>f(x => x) : (x: number) => number
|
||||
>f : <T extends (p1: number) => number>(p: T) => T
|
||||
>x => x : (x: number) => number
|
||||
>x : number
|
||||
>x : number
|
||||
|
||||
12
tests/baselines/reference/inferringAnyFunctionType5.js
Normal file
12
tests/baselines/reference/inferringAnyFunctionType5.js
Normal file
@@ -0,0 +1,12 @@
|
||||
//// [inferringAnyFunctionType5.ts]
|
||||
function f<T extends { q: (p1: number) => number }>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f({ q: x => x });
|
||||
|
||||
//// [inferringAnyFunctionType5.js]
|
||||
function f(p) {
|
||||
return p;
|
||||
}
|
||||
var v = f({ q: function (x) { return x; } });
|
||||
21
tests/baselines/reference/inferringAnyFunctionType5.symbols
Normal file
21
tests/baselines/reference/inferringAnyFunctionType5.symbols
Normal file
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType5.ts ===
|
||||
function f<T extends { q: (p1: number) => number }>(p: T): T {
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType5.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType5.ts, 0, 11))
|
||||
>q : Symbol(q, Decl(inferringAnyFunctionType5.ts, 0, 22))
|
||||
>p1 : Symbol(p1, Decl(inferringAnyFunctionType5.ts, 0, 27))
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType5.ts, 0, 52))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType5.ts, 0, 11))
|
||||
>T : Symbol(T, Decl(inferringAnyFunctionType5.ts, 0, 11))
|
||||
|
||||
return p;
|
||||
>p : Symbol(p, Decl(inferringAnyFunctionType5.ts, 0, 52))
|
||||
}
|
||||
|
||||
var v = f({ q: x => x });
|
||||
>v : Symbol(v, Decl(inferringAnyFunctionType5.ts, 4, 3))
|
||||
>f : Symbol(f, Decl(inferringAnyFunctionType5.ts, 0, 0))
|
||||
>q : Symbol(q, Decl(inferringAnyFunctionType5.ts, 4, 11))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType5.ts, 4, 14))
|
||||
>x : Symbol(x, Decl(inferringAnyFunctionType5.ts, 4, 14))
|
||||
|
||||
24
tests/baselines/reference/inferringAnyFunctionType5.types
Normal file
24
tests/baselines/reference/inferringAnyFunctionType5.types
Normal file
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/inferringAnyFunctionType5.ts ===
|
||||
function f<T extends { q: (p1: number) => number }>(p: T): T {
|
||||
>f : <T extends { q: (p1: number) => number; }>(p: T) => T
|
||||
>T : T
|
||||
>q : (p1: number) => number
|
||||
>p1 : number
|
||||
>p : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return p;
|
||||
>p : T
|
||||
}
|
||||
|
||||
var v = f({ q: x => x });
|
||||
>v : { q: (x: number) => number; }
|
||||
>f({ q: x => x }) : { q: (x: number) => number; }
|
||||
>f : <T extends { q: (p1: number) => number; }>(p: T) => T
|
||||
>{ q: x => x } : { q: (x: number) => number; }
|
||||
>q : (x: number) => number
|
||||
>x => x : (x: number) => number
|
||||
>x : number
|
||||
>x : number
|
||||
|
||||
5
tests/cases/compiler/inferringAnyFunctionType1.ts
Normal file
5
tests/cases/compiler/inferringAnyFunctionType1.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
function f<T extends { "0": (p1: number) => number }>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
5
tests/cases/compiler/inferringAnyFunctionType2.ts
Normal file
5
tests/cases/compiler/inferringAnyFunctionType2.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
function f<T extends [(p1: number) => number]>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
5
tests/cases/compiler/inferringAnyFunctionType3.ts
Normal file
5
tests/cases/compiler/inferringAnyFunctionType3.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
function f<T extends ((p1: number) => number)[]>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f([x => x]);
|
||||
5
tests/cases/compiler/inferringAnyFunctionType4.ts
Normal file
5
tests/cases/compiler/inferringAnyFunctionType4.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
function f<T extends (p1: number) => number>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f(x => x);
|
||||
5
tests/cases/compiler/inferringAnyFunctionType5.ts
Normal file
5
tests/cases/compiler/inferringAnyFunctionType5.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
function f<T extends { q: (p1: number) => number }>(p: T): T {
|
||||
return p;
|
||||
}
|
||||
|
||||
var v = f({ q: x => x });
|
||||
Reference in New Issue
Block a user