Update baselines

This commit is contained in:
Yui T 2017-05-26 11:21:06 -07:00
parent 0cbfc79ca7
commit e82e73753d
26 changed files with 928 additions and 81 deletions

View File

@ -0,0 +1,22 @@
//// [0.js]
// @ts-check
/**
* @param {number=} n
* @param {string} [s]
*/
function foo(n, s) {}
foo();
foo(1);
foo(1, "hi");
//// [0.js]
// @ts-check
/**
* @param {number=} n
* @param {string} [s]
*/
function foo(n, s) { }
foo();
foo(1);
foo(1, "hi");

View File

@ -0,0 +1,20 @@
=== tests/cases/conformance/jsdoc/0.js ===
// @ts-check
/**
* @param {number=} n
* @param {string} [s]
*/
function foo(n, s) {}
>foo : Symbol(foo, Decl(0.js, 0, 0))
>n : Symbol(n, Decl(0.js, 5, 13))
>s : Symbol(s, Decl(0.js, 5, 15))
foo();
>foo : Symbol(foo, Decl(0.js, 0, 0))
foo(1);
>foo : Symbol(foo, Decl(0.js, 0, 0))
foo(1, "hi");
>foo : Symbol(foo, Decl(0.js, 0, 0))

View File

@ -0,0 +1,26 @@
=== tests/cases/conformance/jsdoc/0.js ===
// @ts-check
/**
* @param {number=} n
* @param {string} [s]
*/
function foo(n, s) {}
>foo : (n?: number, s?: string) => void
>n : number
>s : string
foo();
>foo() : void
>foo : (n?: number, s?: string) => void
foo(1);
>foo(1) : void
>foo : (n?: number, s?: string) => void
>1 : 1
foo(1, "hi");
>foo(1, "hi") : void
>foo : (n?: number, s?: string) => void
>1 : 1
>"hi" : "hi"

View File

@ -0,0 +1,43 @@
//// [returns.js]
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return "hello";
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
return "hello world";
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
return 5 || "hello";
}
//// [dummy.js]
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return "hello";
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
return "hello world";
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
return 5 || "hello";
}

View File

@ -0,0 +1,28 @@
=== tests/cases/conformance/jsdoc/returns.js ===
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : Symbol(f, Decl(returns.js, 0, 0))
return "hello";
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
>f1 : Symbol(f1, Decl(returns.js, 6, 1))
return "hello world";
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
>f2 : Symbol(f2, Decl(returns.js, 13, 1))
return 5 || "hello";
}

View File

@ -0,0 +1,33 @@
=== tests/cases/conformance/jsdoc/returns.js ===
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : () => string
return "hello";
>"hello" : "hello"
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
>f1 : () => string
return "hello world";
>"hello world" : "hello world"
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
>f2 : () => string | number
return 5 || "hello";
>5 || "hello" : "hello" | 5
>5 : 5
>"hello" : "hello"
}

View File

@ -0,0 +1,30 @@
//// [returns.js]
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return 5;
}
/**
* @returns {string | number} This comment is not currently exposed
*/
function f1() {
return 5 || true;
}
//// [dummy.js]
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return 5;
}
/**
* @returns {string | number} This comment is not currently exposed
*/
function f1() {
return 5 || true;
}

View File

@ -0,0 +1,19 @@
=== tests/cases/conformance/jsdoc/returns.js ===
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : Symbol(f, Decl(returns.js, 0, 0))
return 5;
}
/**
* @returns {string | number} This comment is not currently exposed
*/
function f1() {
>f1 : Symbol(f1, Decl(returns.js, 6, 1))
return 5 || true;
}

View File

@ -0,0 +1,23 @@
=== tests/cases/conformance/jsdoc/returns.js ===
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : () => string
return 5;
>5 : 5
}
/**
* @returns {string | number} This comment is not currently exposed
*/
function f1() {
>f1 : () => string | number
return 5 || true;
>5 || true : true | 5
>5 : 5
>true : true
}

View File

@ -1,7 +1,14 @@
//// [0.js]
// @ts-check
/** @type {String} */
var S = "hello world";
/** @type {number} */
var n = 10;
/** @type {*} */
var anyT = 2;
anyT = "hello";
/** @type {?} */
var anyT1 = 2;
@ -21,8 +28,13 @@ x2(0);
//// [0.js]
// @ts-check
/** @type {String} */
var S = "hello world";
/** @type {number} */
var n = 10;
/** @type {*} */
var anyT = 2;
anyT = "hello";
/** @type {?} */
var anyT1 = 2;
anyT1 = "hi";

View File

@ -0,0 +1,51 @@
=== tests/cases/conformance/jsdoc/0.js ===
// @ts-check
/** @type {String} */
var S = "hello world";
>S : Symbol(S, Decl(0.js, 2, 3))
/** @type {number} */
var n = 10;
>n : Symbol(n, Decl(0.js, 5, 3))
/** @type {*} */
var anyT = 2;
>anyT : Symbol(anyT, Decl(0.js, 8, 3))
anyT = "hello";
>anyT : Symbol(anyT, Decl(0.js, 8, 3))
/** @type {?} */
var anyT1 = 2;
>anyT1 : Symbol(anyT1, Decl(0.js, 12, 3))
anyT1 = "hi";
>anyT1 : Symbol(anyT1, Decl(0.js, 12, 3))
/** @type {Function} */
const x = (a) => a + 1;
>x : Symbol(x, Decl(0.js, 16, 5))
>a : Symbol(a, Decl(0.js, 16, 11))
>a : Symbol(a, Decl(0.js, 16, 11))
x(1);
>x : Symbol(x, Decl(0.js, 16, 5))
/** @type {function (number)} */
const x1 = (a) => a + 1;
>x1 : Symbol(x1, Decl(0.js, 20, 5))
>a : Symbol(a, Decl(0.js, 20, 12))
>a : Symbol(a, Decl(0.js, 20, 12))
x1(0);
>x1 : Symbol(x1, Decl(0.js, 20, 5))
/** @type {function (number): number} */
const x2 = (a) => a + 1;
>x2 : Symbol(x2, Decl(0.js, 24, 5))
>a : Symbol(a, Decl(0.js, 24, 12))
>a : Symbol(a, Decl(0.js, 24, 12))
x2(0);
>x2 : Symbol(x2, Decl(0.js, 24, 5))

View File

@ -1,10 +1,25 @@
=== tests/cases/conformance/salsa/0.js ===
=== tests/cases/conformance/jsdoc/0.js ===
// @ts-check
/** @type {String} */
var S = "hello world";
>S : string
>"hello world" : "hello world"
/** @type {number} */
var n = 10;
>n : number
>10 : 10
/** @type {*} */
var anyT = 2;
>anyT : any
>2 : 2
anyT = "hello";
>anyT = "hello" : "hello"
>anyT : any
>"hello" : "hello"
/** @type {?} */
var anyT1 = 2;
>anyT1 : any

View File

@ -0,0 +1,42 @@
tests/cases/conformance/jsdoc/0.js(3,5): error TS2322: Type 'true' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(6,5): error TS2322: Type '"hello"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(10,4): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/0.js(13,7): error TS2451: Cannot redeclare block-scoped variable 'x2'.
tests/cases/conformance/jsdoc/0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(20,7): error TS2451: Cannot redeclare block-scoped variable 'x2'.
==== tests/cases/conformance/jsdoc/0.js (6 errors) ====
// @ts-check
/** @type {String} */
var S = true;
~
!!! error TS2322: Type 'true' is not assignable to type 'string'.
/** @type {number} */
var n = "hello";
~
!!! error TS2322: Type '"hello"' is not assignable to type 'number'.
/** @type {function (number)} */
const x1 = (a) => a + 1;
x1("string");
~~~~~~~~
!!! error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
/** @type {function (number): number} */
const x2 = (a) => a + 1;
~~
!!! error TS2451: Cannot redeclare block-scoped variable 'x2'.
/** @type {string} */
var a;
a = x2(0);
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
/** @type {function (number): number} */
const x2 = (a) => a.concat("hi");
~~
!!! error TS2451: Cannot redeclare block-scoped variable 'x2'.
x2(0);

View File

@ -0,0 +1,40 @@
//// [0.js]
// @ts-check
/** @type {String} */
var S = true;
/** @type {number} */
var n = "hello";
/** @type {function (number)} */
const x1 = (a) => a + 1;
x1("string");
/** @type {function (number): number} */
const x2 = (a) => a + 1;
/** @type {string} */
var a;
a = x2(0);
/** @type {function (number): number} */
const x2 = (a) => a.concat("hi");
x2(0);
//// [0.js]
// @ts-check
/** @type {String} */
var S = true;
/** @type {number} */
var n = "hello";
/** @type {function (number)} */
var x1 = function (a) { return a + 1; };
x1("string");
/** @type {function (number): number} */
var x2 = function (a) { return a + 1; };
/** @type {string} */
var a;
a = x2(0);
/** @type {function (number): number} */
var x2 = function (a) { return a.concat("hi"); };
x2(0);

View File

@ -1,8 +1,8 @@
tests/cases/conformance/salsa/0.js(5,4): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
tests/cases/conformance/salsa/0.js(12,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(5,4): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/0.js(12,1): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/salsa/0.js (2 errors) ====
==== tests/cases/conformance/jsdoc/0.js (2 errors) ====
// @ts-check
/** @type {function (number)} */

View File

@ -1,40 +0,0 @@
=== tests/cases/conformance/salsa/0.js ===
// @ts-check
/** @type {*} */
var anyT = 2;
>anyT : Symbol(anyT, Decl(0.js, 2, 3))
/** @type {?} */
var anyT1 = 2;
>anyT1 : Symbol(anyT1, Decl(0.js, 5, 3))
anyT1 = "hi";
>anyT1 : Symbol(anyT1, Decl(0.js, 5, 3))
/** @type {Function} */
const x = (a) => a + 1;
>x : Symbol(x, Decl(0.js, 9, 5))
>a : Symbol(a, Decl(0.js, 9, 11))
>a : Symbol(a, Decl(0.js, 9, 11))
x(1);
>x : Symbol(x, Decl(0.js, 9, 5))
/** @type {function (number)} */
const x1 = (a) => a + 1;
>x1 : Symbol(x1, Decl(0.js, 13, 5))
>a : Symbol(a, Decl(0.js, 13, 12))
>a : Symbol(a, Decl(0.js, 13, 12))
x1(0);
>x1 : Symbol(x1, Decl(0.js, 13, 5))
/** @type {function (number): number} */
const x2 = (a) => a + 1;
>x2 : Symbol(x2, Decl(0.js, 17, 5))
>a : Symbol(a, Decl(0.js, 17, 12))
>a : Symbol(a, Decl(0.js, 17, 12))
x2(0);
>x2 : Symbol(x2, Decl(0.js, 17, 5))

View File

@ -0,0 +1,41 @@
//// [returns.js]
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return 5;
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
return 5;
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
return 5 || "hello";
}
//// [dummy.js]
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return 5;
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
return 5;
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
return 5 || "hello";
}

View File

@ -0,0 +1,27 @@
=== tests/cases/conformance/jsdoc/returns.js ===
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : Symbol(f, Decl(returns.js, 0, 0))
return 5;
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
>f1 : Symbol(f1, Decl(returns.js, 5, 1))
return 5;
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
>f2 : Symbol(f2, Decl(returns.js, 12, 1))
return 5 || "hello";
}

View File

@ -0,0 +1,32 @@
=== tests/cases/conformance/jsdoc/returns.js ===
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : () => string
return 5;
>5 : 5
}
/**
* @returns {string=} This comment is not currently exposed
*/
function f1() {
>f1 : () => string
return 5;
>5 : 5
}
/**
* @returns {string|number} This comment is not currently exposed
*/
function f2() {
>f2 : () => string | number
return 5 || "hello";
>5 || "hello" : 5 | "hello"
>5 : 5
>"hello" : "hello"
}

View File

@ -0,0 +1,141 @@
//// [tests/cases/conformance/jsdoc/jsdocTypeTag.ts] ////
//// [a.js]
/** @type {String} */
var S;
/** @type {string} */
var s;
/** @type {Number} */
var N;
/** @type {number} */
var n;
/** @type {Boolean} */
var B;
/** @type {boolean} */
var b;
/** @type {Void} */
var V;
/** @type {void} */
var v;
/** @type {Undefined} */
var U;
/** @type {undefined} */
var u;
/** @type {Null} */
var Nl;
/** @type {null} */
var nl;
/** @type {Array} */
var A;
/** @type {array} */
var a;
/** @type {Promise} */
var P;
/** @type {promise} */
var p;
/** @type {?number} */
var nullable;
/** @type {Object} */
var Obj;
/** @type {Function} */
var Func;
//// [b.ts]
var S: string;
var s: string;
var N: number;
var n: number
var B: boolean;
var b: boolean;
var V :void;
var v: void;
var U: undefined;
var u: undefined;
var Nl: null;
var nl: null;
var A: any[];
var a: any[];
var P: Promise<any>;
var p: Promise<any>;
var nullable: number | null;
var Obj: any;
var Func: Function;
//// [a.js]
/** @type {String} */
var S;
/** @type {string} */
var s;
/** @type {Number} */
var N;
/** @type {number} */
var n;
/** @type {Boolean} */
var B;
/** @type {boolean} */
var b;
/** @type {Void} */
var V;
/** @type {void} */
var v;
/** @type {Undefined} */
var U;
/** @type {undefined} */
var u;
/** @type {Null} */
var Nl;
/** @type {null} */
var nl;
/** @type {Array} */
var A;
/** @type {array} */
var a;
/** @type {Promise} */
var P;
/** @type {promise} */
var p;
/** @type {?number} */
var nullable;
/** @type {Object} */
var Obj;
/** @type {Function} */
var Func;
//// [b.js]
var S;
var s;
var N;
var n;
var B;
var b;
var V;
var v;
var U;
var u;
var Nl;
var nl;
var A;
var a;
var P;
var p;
var nullable;
var Obj;
var Func;

View File

@ -0,0 +1,138 @@
=== tests/cases/conformance/jsdoc/a.js ===
/** @type {String} */
var S;
>S : Symbol(S, Decl(a.js, 1, 3), Decl(b.ts, 0, 3))
/** @type {string} */
var s;
>s : Symbol(s, Decl(a.js, 4, 3), Decl(b.ts, 1, 3))
/** @type {Number} */
var N;
>N : Symbol(N, Decl(a.js, 7, 3), Decl(b.ts, 2, 3))
/** @type {number} */
var n;
>n : Symbol(n, Decl(a.js, 10, 3), Decl(b.ts, 3, 3))
/** @type {Boolean} */
var B;
>B : Symbol(B, Decl(a.js, 13, 3), Decl(b.ts, 4, 3))
/** @type {boolean} */
var b;
>b : Symbol(b, Decl(a.js, 16, 3), Decl(b.ts, 5, 3))
/** @type {Void} */
var V;
>V : Symbol(V, Decl(a.js, 19, 3), Decl(b.ts, 6, 3))
/** @type {void} */
var v;
>v : Symbol(v, Decl(a.js, 22, 3), Decl(b.ts, 7, 3))
/** @type {Undefined} */
var U;
>U : Symbol(U, Decl(a.js, 25, 3), Decl(b.ts, 8, 3))
/** @type {undefined} */
var u;
>u : Symbol(u, Decl(a.js, 28, 3), Decl(b.ts, 9, 3))
/** @type {Null} */
var Nl;
>Nl : Symbol(Nl, Decl(a.js, 31, 3), Decl(b.ts, 10, 3))
/** @type {null} */
var nl;
>nl : Symbol(nl, Decl(a.js, 34, 3), Decl(b.ts, 11, 3))
/** @type {Array} */
var A;
>A : Symbol(A, Decl(a.js, 37, 3), Decl(b.ts, 12, 3))
/** @type {array} */
var a;
>a : Symbol(a, Decl(a.js, 40, 3), Decl(b.ts, 13, 3))
/** @type {Promise} */
var P;
>P : Symbol(P, Decl(a.js, 43, 3), Decl(b.ts, 14, 3))
/** @type {promise} */
var p;
>p : Symbol(p, Decl(a.js, 46, 3), Decl(b.ts, 15, 3))
/** @type {?number} */
var nullable;
>nullable : Symbol(nullable, Decl(a.js, 49, 3), Decl(b.ts, 16, 3))
/** @type {Object} */
var Obj;
>Obj : Symbol(Obj, Decl(a.js, 52, 3), Decl(b.ts, 17, 3))
/** @type {Function} */
var Func;
>Func : Symbol(Func, Decl(a.js, 55, 3), Decl(b.ts, 18, 3))
=== tests/cases/conformance/jsdoc/b.ts ===
var S: string;
>S : Symbol(S, Decl(a.js, 1, 3), Decl(b.ts, 0, 3))
var s: string;
>s : Symbol(s, Decl(a.js, 4, 3), Decl(b.ts, 1, 3))
var N: number;
>N : Symbol(N, Decl(a.js, 7, 3), Decl(b.ts, 2, 3))
var n: number
>n : Symbol(n, Decl(a.js, 10, 3), Decl(b.ts, 3, 3))
var B: boolean;
>B : Symbol(B, Decl(a.js, 13, 3), Decl(b.ts, 4, 3))
var b: boolean;
>b : Symbol(b, Decl(a.js, 16, 3), Decl(b.ts, 5, 3))
var V :void;
>V : Symbol(V, Decl(a.js, 19, 3), Decl(b.ts, 6, 3))
var v: void;
>v : Symbol(v, Decl(a.js, 22, 3), Decl(b.ts, 7, 3))
var U: undefined;
>U : Symbol(U, Decl(a.js, 25, 3), Decl(b.ts, 8, 3))
var u: undefined;
>u : Symbol(u, Decl(a.js, 28, 3), Decl(b.ts, 9, 3))
var Nl: null;
>Nl : Symbol(Nl, Decl(a.js, 31, 3), Decl(b.ts, 10, 3))
var nl: null;
>nl : Symbol(nl, Decl(a.js, 34, 3), Decl(b.ts, 11, 3))
var A: any[];
>A : Symbol(A, Decl(a.js, 37, 3), Decl(b.ts, 12, 3))
var a: any[];
>a : Symbol(a, Decl(a.js, 40, 3), Decl(b.ts, 13, 3))
var P: Promise<any>;
>P : Symbol(P, Decl(a.js, 43, 3), Decl(b.ts, 14, 3))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --))
var p: Promise<any>;
>p : Symbol(p, Decl(a.js, 46, 3), Decl(b.ts, 15, 3))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --))
var nullable: number | null;
>nullable : Symbol(nullable, Decl(a.js, 49, 3), Decl(b.ts, 16, 3))
var Obj: any;
>Obj : Symbol(Obj, Decl(a.js, 52, 3), Decl(b.ts, 17, 3))
var Func: Function;
>Func : Symbol(Func, Decl(a.js, 55, 3), Decl(b.ts, 18, 3))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View File

@ -0,0 +1,141 @@
=== tests/cases/conformance/jsdoc/a.js ===
/** @type {String} */
var S;
>S : string
/** @type {string} */
var s;
>s : string
/** @type {Number} */
var N;
>N : number
/** @type {number} */
var n;
>n : number
/** @type {Boolean} */
var B;
>B : boolean
/** @type {boolean} */
var b;
>b : boolean
/** @type {Void} */
var V;
>V : void
/** @type {void} */
var v;
>v : void
/** @type {Undefined} */
var U;
>U : undefined
/** @type {undefined} */
var u;
>u : undefined
/** @type {Null} */
var Nl;
>Nl : null
/** @type {null} */
var nl;
>nl : null
/** @type {Array} */
var A;
>A : any[]
/** @type {array} */
var a;
>a : any[]
/** @type {Promise} */
var P;
>P : Promise<any>
/** @type {promise} */
var p;
>p : Promise<any>
/** @type {?number} */
var nullable;
>nullable : number | null
/** @type {Object} */
var Obj;
>Obj : any
/** @type {Function} */
var Func;
>Func : Function
=== tests/cases/conformance/jsdoc/b.ts ===
var S: string;
>S : string
var s: string;
>s : string
var N: number;
>N : number
var n: number
>n : number
var B: boolean;
>B : boolean
var b: boolean;
>b : boolean
var V :void;
>V : void
var v: void;
>v : void
var U: undefined;
>U : undefined
var u: undefined;
>u : undefined
var Nl: null;
>Nl : null
>null : null
var nl: null;
>nl : null
>null : null
var A: any[];
>A : any[]
var a: any[];
>a : any[]
var P: Promise<any>;
>P : Promise<any>
>Promise : Promise<T>
var p: Promise<any>;
>p : Promise<any>
>Promise : Promise<T>
var nullable: number | null;
>nullable : number | null
>null : null
var Obj: any;
>Obj : any
var Func: Function;
>Func : Function
>Function : Function

View File

@ -1,16 +0,0 @@
//// [returns.js]
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return "";
}
//// [dummy.js]
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return "";
}

View File

@ -1,10 +0,0 @@
=== tests/cases/conformance/jsdoc/returns.js ===
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : Symbol(f, Decl(returns.js, 0, 0))
return "";
}

View File

@ -1,11 +0,0 @@
=== tests/cases/conformance/jsdoc/returns.js ===
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
>f : () => string
return "";
>"" : ""
}