112 lines
2.6 KiB
Plaintext
112 lines
2.6 KiB
Plaintext
exports[`test fail-0.js 1`] = `
|
|
"// @flow
|
|
|
|
// Error: \'declare\', \'checks\' but missing predicate
|
|
|
|
declare function f2(x: mixed): boolean %checks;
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// @flow
|
|
// Error: \'declare\', \'checks\' but missing predicate
|
|
declare function f2(x: mixed): boolean;
|
|
"
|
|
`;
|
|
|
|
exports[`test fail-1.js 1`] = `
|
|
"// @flow
|
|
|
|
// Error: no return statement
|
|
|
|
function f6(x: mixed): %checks (x !== null) { }
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// @flow
|
|
// Error: no return statement
|
|
function f6(x: mixed): %checks(x !== null) {
|
|
|
|
}
|
|
"
|
|
`;
|
|
|
|
exports[`test fail-2.js 1`] = `
|
|
"// @flow
|
|
|
|
var a2 = (x: mixed): %checks (x !== null) => { // Error: body form
|
|
var x = 1; return x;
|
|
}
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// @flow
|
|
// Error: body form
|
|
var a2 = (x: mixed): %checks(x !== null) => {
|
|
var x = 1;
|
|
return x;
|
|
};
|
|
"
|
|
`;
|
|
|
|
exports[`test fail-3.js 1`] = `
|
|
"// @flow
|
|
|
|
// Cannot declare predicate with a function body is present.
|
|
|
|
function f5(x: mixed): %checks (x !== null) { return x !== null }
|
|
|
|
var a2 = (x: mixed): %checks (x !== null) => x !== null;
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// @flow
|
|
// Cannot declare predicate with a function body is present.
|
|
function f5(x: mixed): %checks(x !== null) {
|
|
return x !== null;
|
|
}
|
|
var a2 = (x: mixed): %checks(x !== null) => x !== null;
|
|
"
|
|
`;
|
|
|
|
exports[`test pass.js 1`] = `
|
|
"// @flow
|
|
|
|
declare function f1(x: mixed): boolean;
|
|
|
|
declare function f3(x: mixed): boolean %checks (x !== null);
|
|
|
|
declare function f4(x: mixed): boolean %checks (x !== null);
|
|
|
|
function f7(x: mixed): %checks { return x !== null }
|
|
|
|
var a0 = (x: mixed) => x !== null;
|
|
|
|
var a1 = (x: mixed): %checks => x !== null;
|
|
|
|
(x): %checks => x !== null;
|
|
|
|
const insert_a_really_big_predicated_arrow_function_name_here = (x)
|
|
: %checks => x !== null;
|
|
|
|
declare var x;
|
|
(x)
|
|
checks => 123;
|
|
|
|
type checks = any;
|
|
|
|
declare function f(x: mixed): checks
|
|
(typeof x === null);
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// @flow
|
|
declare function f1(x: mixed): boolean;
|
|
declare function f3(x: mixed): boolean;
|
|
declare function f4(x: mixed): boolean;
|
|
function f7(x: mixed): %checks {
|
|
return x !== null;
|
|
}
|
|
var a0 = (x: mixed) => x !== null;
|
|
var a1 = (x: mixed): %checks => x !== null;
|
|
(x): %checks => x !== null;
|
|
const insert_a_really_big_predicated_arrow_function_name_here = (x): %checks => x !==
|
|
null;
|
|
declare var x;
|
|
x;
|
|
checks => 123;
|
|
type checks = any;
|
|
declare function f(x: mixed): checks;
|
|
typeof x === null;
|
|
"
|
|
`;
|