From 8529de64d77aadf367ac54a223a329f0ae8f9aac Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 22 Jul 2015 13:58:43 -0700 Subject: [PATCH] Add tests --- .../reference/inferringAnyFunctionType1.js | 12 ++++++++++ .../inferringAnyFunctionType1.symbols | 19 +++++++++++++++ .../reference/inferringAnyFunctionType1.types | 22 +++++++++++++++++ .../reference/inferringAnyFunctionType2.js | 12 ++++++++++ .../inferringAnyFunctionType2.symbols | 19 +++++++++++++++ .../reference/inferringAnyFunctionType2.types | 22 +++++++++++++++++ .../reference/inferringAnyFunctionType3.js | 12 ++++++++++ .../inferringAnyFunctionType3.symbols | 19 +++++++++++++++ .../reference/inferringAnyFunctionType3.types | 22 +++++++++++++++++ .../reference/inferringAnyFunctionType4.js | 12 ++++++++++ .../inferringAnyFunctionType4.symbols | 19 +++++++++++++++ .../reference/inferringAnyFunctionType4.types | 21 ++++++++++++++++ .../reference/inferringAnyFunctionType5.js | 12 ++++++++++ .../inferringAnyFunctionType5.symbols | 21 ++++++++++++++++ .../reference/inferringAnyFunctionType5.types | 24 +++++++++++++++++++ .../compiler/inferringAnyFunctionType1.ts | 5 ++++ .../compiler/inferringAnyFunctionType2.ts | 5 ++++ .../compiler/inferringAnyFunctionType3.ts | 5 ++++ .../compiler/inferringAnyFunctionType4.ts | 5 ++++ .../compiler/inferringAnyFunctionType5.ts | 5 ++++ 20 files changed, 293 insertions(+) create mode 100644 tests/baselines/reference/inferringAnyFunctionType1.js create mode 100644 tests/baselines/reference/inferringAnyFunctionType1.symbols create mode 100644 tests/baselines/reference/inferringAnyFunctionType1.types create mode 100644 tests/baselines/reference/inferringAnyFunctionType2.js create mode 100644 tests/baselines/reference/inferringAnyFunctionType2.symbols create mode 100644 tests/baselines/reference/inferringAnyFunctionType2.types create mode 100644 tests/baselines/reference/inferringAnyFunctionType3.js create mode 100644 tests/baselines/reference/inferringAnyFunctionType3.symbols create mode 100644 tests/baselines/reference/inferringAnyFunctionType3.types create mode 100644 tests/baselines/reference/inferringAnyFunctionType4.js create mode 100644 tests/baselines/reference/inferringAnyFunctionType4.symbols create mode 100644 tests/baselines/reference/inferringAnyFunctionType4.types create mode 100644 tests/baselines/reference/inferringAnyFunctionType5.js create mode 100644 tests/baselines/reference/inferringAnyFunctionType5.symbols create mode 100644 tests/baselines/reference/inferringAnyFunctionType5.types create mode 100644 tests/cases/compiler/inferringAnyFunctionType1.ts create mode 100644 tests/cases/compiler/inferringAnyFunctionType2.ts create mode 100644 tests/cases/compiler/inferringAnyFunctionType3.ts create mode 100644 tests/cases/compiler/inferringAnyFunctionType4.ts create mode 100644 tests/cases/compiler/inferringAnyFunctionType5.ts diff --git a/tests/baselines/reference/inferringAnyFunctionType1.js b/tests/baselines/reference/inferringAnyFunctionType1.js new file mode 100644 index 00000000000..6b48cf2db58 --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType1.js @@ -0,0 +1,12 @@ +//// [inferringAnyFunctionType1.ts] +function f 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; }]); diff --git a/tests/baselines/reference/inferringAnyFunctionType1.symbols b/tests/baselines/reference/inferringAnyFunctionType1.symbols new file mode 100644 index 00000000000..6a43952d770 --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType1.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/inferringAnyFunctionType1.ts === +function f 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)) + diff --git a/tests/baselines/reference/inferringAnyFunctionType1.types b/tests/baselines/reference/inferringAnyFunctionType1.types new file mode 100644 index 00000000000..16402cc3ced --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType1.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/inferringAnyFunctionType1.ts === +function f number }>(p: T): T { +>f : 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 : number; }>(p: T) => T +>[x => x] : [(x: number) => number] +>x => x : (x: number) => number +>x : number +>x : number + diff --git a/tests/baselines/reference/inferringAnyFunctionType2.js b/tests/baselines/reference/inferringAnyFunctionType2.js new file mode 100644 index 00000000000..3841793233e --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType2.js @@ -0,0 +1,12 @@ +//// [inferringAnyFunctionType2.ts] +function f 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; }]); diff --git a/tests/baselines/reference/inferringAnyFunctionType2.symbols b/tests/baselines/reference/inferringAnyFunctionType2.symbols new file mode 100644 index 00000000000..9bdb627d46d --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType2.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/inferringAnyFunctionType2.ts === +function f 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)) + diff --git a/tests/baselines/reference/inferringAnyFunctionType2.types b/tests/baselines/reference/inferringAnyFunctionType2.types new file mode 100644 index 00000000000..7884bdfc6ba --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType2.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/inferringAnyFunctionType2.ts === +function f number]>(p: T): T { +>f : 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 : number]>(p: T) => T +>[x => x] : [(x: number) => number] +>x => x : (x: number) => number +>x : number +>x : number + diff --git a/tests/baselines/reference/inferringAnyFunctionType3.js b/tests/baselines/reference/inferringAnyFunctionType3.js new file mode 100644 index 00000000000..ed1c4348dfc --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType3.js @@ -0,0 +1,12 @@ +//// [inferringAnyFunctionType3.ts] +function f 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; }]); diff --git a/tests/baselines/reference/inferringAnyFunctionType3.symbols b/tests/baselines/reference/inferringAnyFunctionType3.symbols new file mode 100644 index 00000000000..472d170b81d --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType3.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/inferringAnyFunctionType3.ts === +function f 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)) + diff --git a/tests/baselines/reference/inferringAnyFunctionType3.types b/tests/baselines/reference/inferringAnyFunctionType3.types new file mode 100644 index 00000000000..1edcfc34643 --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType3.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/inferringAnyFunctionType3.ts === +function f number)[]>(p: T): T { +>f : 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 : number)[]>(p: T) => T +>[x => x] : ((x: number) => number)[] +>x => x : (x: number) => number +>x : number +>x : number + diff --git a/tests/baselines/reference/inferringAnyFunctionType4.js b/tests/baselines/reference/inferringAnyFunctionType4.js new file mode 100644 index 00000000000..dccc51920b0 --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType4.js @@ -0,0 +1,12 @@ +//// [inferringAnyFunctionType4.ts] +function f 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; }); diff --git a/tests/baselines/reference/inferringAnyFunctionType4.symbols b/tests/baselines/reference/inferringAnyFunctionType4.symbols new file mode 100644 index 00000000000..bfbacfc277c --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType4.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/inferringAnyFunctionType4.ts === +function f 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)) + diff --git a/tests/baselines/reference/inferringAnyFunctionType4.types b/tests/baselines/reference/inferringAnyFunctionType4.types new file mode 100644 index 00000000000..49d46d0433e --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType4.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/inferringAnyFunctionType4.ts === +function f number>(p: T): T { +>f : 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 : number>(p: T) => T +>x => x : (x: number) => number +>x : number +>x : number + diff --git a/tests/baselines/reference/inferringAnyFunctionType5.js b/tests/baselines/reference/inferringAnyFunctionType5.js new file mode 100644 index 00000000000..babbab1be9e --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType5.js @@ -0,0 +1,12 @@ +//// [inferringAnyFunctionType5.ts] +function f 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; } }); diff --git a/tests/baselines/reference/inferringAnyFunctionType5.symbols b/tests/baselines/reference/inferringAnyFunctionType5.symbols new file mode 100644 index 00000000000..abf0fe68f46 --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType5.symbols @@ -0,0 +1,21 @@ +=== tests/cases/compiler/inferringAnyFunctionType5.ts === +function f 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)) + diff --git a/tests/baselines/reference/inferringAnyFunctionType5.types b/tests/baselines/reference/inferringAnyFunctionType5.types new file mode 100644 index 00000000000..8f7ae123eac --- /dev/null +++ b/tests/baselines/reference/inferringAnyFunctionType5.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/inferringAnyFunctionType5.ts === +function f number }>(p: T): T { +>f : 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 : number; }>(p: T) => T +>{ q: x => x } : { q: (x: number) => number; } +>q : (x: number) => number +>x => x : (x: number) => number +>x : number +>x : number + diff --git a/tests/cases/compiler/inferringAnyFunctionType1.ts b/tests/cases/compiler/inferringAnyFunctionType1.ts new file mode 100644 index 00000000000..bc1e6f68973 --- /dev/null +++ b/tests/cases/compiler/inferringAnyFunctionType1.ts @@ -0,0 +1,5 @@ +function f number }>(p: T): T { + return p; +} + +var v = f([x => x]); \ No newline at end of file diff --git a/tests/cases/compiler/inferringAnyFunctionType2.ts b/tests/cases/compiler/inferringAnyFunctionType2.ts new file mode 100644 index 00000000000..0984e578f67 --- /dev/null +++ b/tests/cases/compiler/inferringAnyFunctionType2.ts @@ -0,0 +1,5 @@ +function f number]>(p: T): T { + return p; +} + +var v = f([x => x]); \ No newline at end of file diff --git a/tests/cases/compiler/inferringAnyFunctionType3.ts b/tests/cases/compiler/inferringAnyFunctionType3.ts new file mode 100644 index 00000000000..4576a30898a --- /dev/null +++ b/tests/cases/compiler/inferringAnyFunctionType3.ts @@ -0,0 +1,5 @@ +function f number)[]>(p: T): T { + return p; +} + +var v = f([x => x]); \ No newline at end of file diff --git a/tests/cases/compiler/inferringAnyFunctionType4.ts b/tests/cases/compiler/inferringAnyFunctionType4.ts new file mode 100644 index 00000000000..592908bdfec --- /dev/null +++ b/tests/cases/compiler/inferringAnyFunctionType4.ts @@ -0,0 +1,5 @@ +function f number>(p: T): T { + return p; +} + +var v = f(x => x); \ No newline at end of file diff --git a/tests/cases/compiler/inferringAnyFunctionType5.ts b/tests/cases/compiler/inferringAnyFunctionType5.ts new file mode 100644 index 00000000000..2ff4a325c5a --- /dev/null +++ b/tests/cases/compiler/inferringAnyFunctionType5.ts @@ -0,0 +1,5 @@ +function f number }>(p: T): T { + return p; +} + +var v = f({ q: x => x }); \ No newline at end of file