* Remove check narrowing only certain types, add test showing issues with this * string literal case test * Reconcile fix with CFA work * Defaultable -> NotNarrowable to align with use * Missed a defaultable in comments * Add test for narrowing to unions of string literals * Rewrite isInStringLiteral to accomodate for unterminated strings * Refactor signatureHelp to expose helper functions * Add support for completion in string literals * Remove unused check * Use const instead of let * Fix error * Formatting changes * Use shorthand properties * Add failing test for #8738 * Sort baseline reference identifier by name * Detects assignment to internal module export clause, fixes #8738 * add SharedArrayBuffer fix * Factor out assignment op check * Add test for composite assignment * Factor out the behaviour and handles x++ and ++x * Handles ES3 default as identifier name * Fix missing else statement * isNameOfExportedDeclarationInNonES6Module * Reorder options alphabetically * Mark diagnostics, and skipDefaultLibCheck as internal * Allow an import of "foo.js" to be matched by a file "foo.ts" * Improve loadModuleFromFile code * Respond to PR comments * Respond to more PR comments * Fix test * Actually merge from master * Revert to old tryLoad implementation * Run fixupParentReferences when parsing isolated jsDocComment * initial revision of unit test support for project system in tsserver * Allow wildcard ("*") patterns in ambient module declarations * Add non-widening forms of null and undefined * Create separate control flows for property declarations with initializers * Add regression test * Allow trailing commas in function parameter and argument lists * Add tests * Remove unused variable * Add null check and CR feedback * Support shorthand ambient module declarations * Revert "Merge pull request #7235 from weswigham/narrow-all-types" This reverts commitef0f6c8fe4
, reversing changes made to9f087cb62a
. * reuse the fixupParentReferences function * Improve typing of && operator with --strictNullChecks * Add test * Respond to PR comments * Respond to PR comments * Add merging tests * Use a function `stringify` to simplify calls to `JSON.stringify(xyz, undefined, 2)` * Update tests * Fix mistake * Include indent in navigation bar protocol Previously navbar01 test had indents when run in the browser but not when run from node. Now they run the same. * Remove unnecessary restrictions in property access narrowing * Fix fourslash test * Add regression test * Consider property declarations to be control flow containers * Adding regression test * Remove restriction on --target es5 and --module es6 * change type definition for Object.create * Fix signature help * Add "implicit any" warning for shorthand ambient modules * Remove trailing whitespace * Support using string values in enums for CompilerOptions in transpile methods * Remove trailing whitespace in jakefile * Make `jake runtests-browser` support test regexes with spaces For example: `jake runtests-browser t="transpile .js files"` now works. * Add another test * factor out isJsxOrTsxExtension * Move to a conformance test * Revert "Revert "Merge pull request #7235 from weswigham/narrow-all-types"" This reverts commitfc3e040c51
. * Use inclusive flag, as originally done, but include almost everything * Add additional tests * Respond to PR comments * Fix typo * add tests for tsserver project system * Fix test * Allow case comparison to undefined and null in strict null checking mode * Remove incorrectly added tests * check if moduleResolution when verifying that program can be reused * more tests for module resolution change and exclude * Fix linting issues * Merge JSDoc of assignments from function expressions * Allow nested assignments in type guards * Add tests * Improve order of parameter's merged jsdoc * Force LF newlines for LKG builds/non debug builds Fixes 6630 * Create intersection types in type guards for unrelated types * Split commentsFunction test into expr/decl And renumber. * Remove TODO comments * Accept new baselines * Add tests * Remove comments * Fix test helper * Recognize relative path using in outDir property (#9025) * Recognize relative path using in outDir property * Add projects tests * Add project .json files * Update baselines * Add comments * Add test case The test passes in 1.8 and fails in master. * Return trace when exception happens * Remove Long-Done TODO AFAIK, the harness sources have been concatenated into `run.js` for as long as I've known. This stops executing them twice (and in turn makes debugging tests much easier, since you no longer have to debug into eval'd code). * Allow primitive type guards with typeof on right Previously, only type guards of the form `typeof x === 'string'` were allowed. Now you can write `'string' === typeof x`. * Primitive type guards are now order independent * Fix comments in tests * Add handleing for classes * Add more tests for target=es5 module=es6 * addExportToArgumentListKind * Accept baseline * Add more tests * wip-fixing transforms * Adds progress indicators to the runtests-parallel build task. * Fixed typo * Fix comment * Add test for out-of-range error * Use proper method of not resolving alias * Fix module loading error (commandLineOptions_stringToEnum would be undefined if optionDeclarations wasn't loaded yet) * Port 8739 * Update tests * Update baselines * Contextually type return statement in async function * Remove stale files * Undo change * Improve perf * Improve tests * Fix sourcemaps for debugging tests * Allow --sourceRoot with --inlineSources option Fixes #8445 * this in parameter initializers resolves to class Accept baselines now that the test passes. * Add tests for more kinds of import/export * Fix7334 Disallow async in functionExpression and ArrowFunction (#9062) * Error when using async modifier in function-expression and arrow-function when target es5 * Add tests and baselines * Resolve function-this in parameter initialisers when explicitly provided * Allow null/undefined guard with null/undefined on left Also add a test with baselines. * Code review comments * Update more diagnostic messages ES6->2015 Fix #8996 CC @mhegazy. * Fixes an issue with runtests-parallel when global mocha is not installed. * Update LKG * Add tests * fix baselines * Recommend runtests-parallel in CONTRIBUTING * Only inlineSourceMap when debugging through jake-browser (#9080) * Only inlineSourceMap when debugging through jake-browser * Address PR: fix typo in opt's property * Manually port tests from PR 8470 * minor fix: add missing return clause * Support using string values in enums for CompilerOptions in transpile methods * Support using string values in enums for CompilerOptions in transpile methods # Conflicts: # tests/cases/unittests/transpile.ts * Fix test helper * Add test for out-of-range error * Fix module loading error (commandLineOptions_stringToEnum would be undefined if optionDeclarations wasn't loaded yet) * Use camel-case instead of snake-case (#9134) * Manually add tests for PR 8988 * Allow wildcard ("*") patterns in ambient module declarations * Respond to PR comments * Add another test * Improve perf * Improve tests * Update baseline from merging with master * Address PR comment * Update baseline * Refactor how we retrieve binding-name cache in module transformer * Temporary accept so we get a clean run-tests result
157 lines
2.7 KiB
TypeScript
157 lines
2.7 KiB
TypeScript
//// [logicalAndOperatorStrictMode.ts]
|
|
|
|
const a = [0];
|
|
const s = "";
|
|
const x = 0;
|
|
const b = false;
|
|
const v: void = undefined;
|
|
const u = undefined;
|
|
const n = null;
|
|
const z = s || x || u;
|
|
|
|
const a1 = a && a;
|
|
const a2 = a && s;
|
|
const a3 = a && x;
|
|
const a4 = a && b;
|
|
const a5 = a && v;
|
|
const a6 = a && u;
|
|
const a7 = a && n;
|
|
const a8 = a && z;
|
|
|
|
const s1 = s && a;
|
|
const s2 = s && s;
|
|
const s3 = s && x;
|
|
const s4 = s && b;
|
|
const s5 = s && v;
|
|
const s6 = s && u;
|
|
const s7 = s && n;
|
|
const s8 = s && z;
|
|
|
|
const x1 = x && a;
|
|
const x2 = x && s;
|
|
const x3 = x && x;
|
|
const x4 = x && b;
|
|
const x5 = x && v;
|
|
const x6 = x && u;
|
|
const x7 = x && n;
|
|
const x8 = x && z;
|
|
|
|
const b1 = b && a;
|
|
const b2 = b && s;
|
|
const b3 = b && x;
|
|
const b4 = b && b;
|
|
const b5 = b && v;
|
|
const b6 = b && u;
|
|
const b7 = b && n;
|
|
const b8 = b && z;
|
|
|
|
const v1 = v && a;
|
|
const v2 = v && s;
|
|
const v3 = v && x;
|
|
const v4 = v && b;
|
|
const v5 = v && v;
|
|
const v6 = v && u;
|
|
const v7 = v && n;
|
|
const v8 = v && z;
|
|
|
|
const u1 = u && a;
|
|
const u2 = u && s;
|
|
const u3 = u && x;
|
|
const u4 = u && b;
|
|
const u5 = u && v;
|
|
const u6 = u && u;
|
|
const u7 = u && n;
|
|
const u8 = u && z;
|
|
|
|
const n1 = n && a;
|
|
const n2 = n && s;
|
|
const n3 = n && x;
|
|
const n4 = n && b;
|
|
const n5 = n && v;
|
|
const n6 = n && u;
|
|
const n7 = n && n;
|
|
const n8 = n && z;
|
|
|
|
const z1 = z && a;
|
|
const z2 = z && s;
|
|
const z3 = z && x;
|
|
const z4 = z && b;
|
|
const z5 = z && v;
|
|
const z6 = z && u;
|
|
const z7 = z && n;
|
|
const z8 = z && z;
|
|
|
|
//// [logicalAndOperatorStrictMode.js]
|
|
var a = [0];
|
|
var s = "";
|
|
var x = 0;
|
|
var b = false;
|
|
var v = undefined;
|
|
var u = undefined;
|
|
var n = null;
|
|
var z = s || x || u;
|
|
var a1 = a && a;
|
|
var a2 = a && s;
|
|
var a3 = a && x;
|
|
var a4 = a && b;
|
|
var a5 = a && v;
|
|
var a6 = a && u;
|
|
var a7 = a && n;
|
|
var a8 = a && z;
|
|
var s1 = s && a;
|
|
var s2 = s && s;
|
|
var s3 = s && x;
|
|
var s4 = s && b;
|
|
var s5 = s && v;
|
|
var s6 = s && u;
|
|
var s7 = s && n;
|
|
var s8 = s && z;
|
|
var x1 = x && a;
|
|
var x2 = x && s;
|
|
var x3 = x && x;
|
|
var x4 = x && b;
|
|
var x5 = x && v;
|
|
var x6 = x && u;
|
|
var x7 = x && n;
|
|
var x8 = x && z;
|
|
var b1 = b && a;
|
|
var b2 = b && s;
|
|
var b3 = b && x;
|
|
var b4 = b && b;
|
|
var b5 = b && v;
|
|
var b6 = b && u;
|
|
var b7 = b && n;
|
|
var b8 = b && z;
|
|
var v1 = v && a;
|
|
var v2 = v && s;
|
|
var v3 = v && x;
|
|
var v4 = v && b;
|
|
var v5 = v && v;
|
|
var v6 = v && u;
|
|
var v7 = v && n;
|
|
var v8 = v && z;
|
|
var u1 = u && a;
|
|
var u2 = u && s;
|
|
var u3 = u && x;
|
|
var u4 = u && b;
|
|
var u5 = u && v;
|
|
var u6 = u && u;
|
|
var u7 = u && n;
|
|
var u8 = u && z;
|
|
var n1 = n && a;
|
|
var n2 = n && s;
|
|
var n3 = n && x;
|
|
var n4 = n && b;
|
|
var n5 = n && v;
|
|
var n6 = n && u;
|
|
var n7 = n && n;
|
|
var n8 = n && z;
|
|
var z1 = z && a;
|
|
var z2 = z && s;
|
|
var z3 = z && x;
|
|
var z4 = z && b;
|
|
var z5 = z && v;
|
|
var z6 = z && u;
|
|
var z7 = z && n;
|
|
var z8 = z && z;
|